@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/node/index.mjs
CHANGED
|
@@ -681,18 +681,6 @@ var Type;
|
|
|
681
681
|
*/
|
|
682
682
|
Type["NULL"] = "NULL";
|
|
683
683
|
})(Type || (Type = {}));
|
|
684
|
-
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
685
|
-
var Mode;
|
|
686
|
-
(function (Mode) {
|
|
687
|
-
/**
|
|
688
|
-
* Always trigger retrieval.
|
|
689
|
-
*/
|
|
690
|
-
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
691
|
-
/**
|
|
692
|
-
* Run retrieval only when system decides it is necessary.
|
|
693
|
-
*/
|
|
694
|
-
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
695
|
-
})(Mode || (Mode = {}));
|
|
696
684
|
/** The API spec that the external API implements. This enum is not supported in Gemini API. */
|
|
697
685
|
var ApiSpec;
|
|
698
686
|
(function (ApiSpec) {
|
|
@@ -795,21 +783,81 @@ var PhishBlockThreshold;
|
|
|
795
783
|
*/
|
|
796
784
|
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
797
785
|
})(PhishBlockThreshold || (PhishBlockThreshold = {}));
|
|
798
|
-
/**
|
|
786
|
+
/** Specifies the function Behavior. Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI. */
|
|
787
|
+
var Behavior;
|
|
788
|
+
(function (Behavior) {
|
|
789
|
+
/**
|
|
790
|
+
* This value is unused.
|
|
791
|
+
*/
|
|
792
|
+
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
793
|
+
/**
|
|
794
|
+
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
795
|
+
*/
|
|
796
|
+
Behavior["BLOCKING"] = "BLOCKING";
|
|
797
|
+
/**
|
|
798
|
+
* 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.
|
|
799
|
+
*/
|
|
800
|
+
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
801
|
+
})(Behavior || (Behavior = {}));
|
|
802
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
803
|
+
var DynamicRetrievalConfigMode;
|
|
804
|
+
(function (DynamicRetrievalConfigMode) {
|
|
805
|
+
/**
|
|
806
|
+
* Always trigger retrieval.
|
|
807
|
+
*/
|
|
808
|
+
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
809
|
+
/**
|
|
810
|
+
* Run retrieval only when system decides it is necessary.
|
|
811
|
+
*/
|
|
812
|
+
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
813
|
+
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
814
|
+
/** Function calling mode. */
|
|
815
|
+
var FunctionCallingConfigMode;
|
|
816
|
+
(function (FunctionCallingConfigMode) {
|
|
817
|
+
/**
|
|
818
|
+
* Unspecified function calling mode. This value should not be used.
|
|
819
|
+
*/
|
|
820
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
821
|
+
/**
|
|
822
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
823
|
+
*/
|
|
824
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
825
|
+
/**
|
|
826
|
+
* 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".
|
|
827
|
+
*/
|
|
828
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
829
|
+
/**
|
|
830
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
831
|
+
*/
|
|
832
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
833
|
+
/**
|
|
834
|
+
* 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".
|
|
835
|
+
*/
|
|
836
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
837
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
838
|
+
/** The number of thoughts tokens that the model should generate. */
|
|
799
839
|
var ThinkingLevel;
|
|
800
840
|
(function (ThinkingLevel) {
|
|
801
841
|
/**
|
|
802
|
-
*
|
|
842
|
+
* Unspecified thinking level.
|
|
803
843
|
*/
|
|
804
844
|
ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
|
|
805
845
|
/**
|
|
806
846
|
* Low thinking level.
|
|
807
847
|
*/
|
|
808
848
|
ThinkingLevel["LOW"] = "LOW";
|
|
849
|
+
/**
|
|
850
|
+
* Medium thinking level.
|
|
851
|
+
*/
|
|
852
|
+
ThinkingLevel["MEDIUM"] = "MEDIUM";
|
|
809
853
|
/**
|
|
810
854
|
* High thinking level.
|
|
811
855
|
*/
|
|
812
856
|
ThinkingLevel["HIGH"] = "HIGH";
|
|
857
|
+
/**
|
|
858
|
+
* MINIMAL thinking level.
|
|
859
|
+
*/
|
|
860
|
+
ThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
813
861
|
})(ThinkingLevel || (ThinkingLevel = {}));
|
|
814
862
|
/** Harm category. */
|
|
815
863
|
var HarmCategory;
|
|
@@ -1280,6 +1328,10 @@ var PartMediaResolutionLevel;
|
|
|
1280
1328
|
* Media resolution set to high.
|
|
1281
1329
|
*/
|
|
1282
1330
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1331
|
+
/**
|
|
1332
|
+
* Media resolution set to ultra high.
|
|
1333
|
+
*/
|
|
1334
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
1283
1335
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
1284
1336
|
/** Options for feature selection preference. */
|
|
1285
1337
|
var FeatureSelectionPreference;
|
|
@@ -1289,34 +1341,6 @@ var FeatureSelectionPreference;
|
|
|
1289
1341
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1290
1342
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1291
1343
|
})(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
|
|
1292
|
-
/** Defines the function behavior. Defaults to `BLOCKING`. */
|
|
1293
|
-
var Behavior;
|
|
1294
|
-
(function (Behavior) {
|
|
1295
|
-
/**
|
|
1296
|
-
* This value is unused.
|
|
1297
|
-
*/
|
|
1298
|
-
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
1299
|
-
/**
|
|
1300
|
-
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
1301
|
-
*/
|
|
1302
|
-
Behavior["BLOCKING"] = "BLOCKING";
|
|
1303
|
-
/**
|
|
1304
|
-
* 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.
|
|
1305
|
-
*/
|
|
1306
|
-
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
1307
|
-
})(Behavior || (Behavior = {}));
|
|
1308
|
-
/** Config for the dynamic retrieval config mode. */
|
|
1309
|
-
var DynamicRetrievalConfigMode;
|
|
1310
|
-
(function (DynamicRetrievalConfigMode) {
|
|
1311
|
-
/**
|
|
1312
|
-
* Always trigger retrieval.
|
|
1313
|
-
*/
|
|
1314
|
-
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1315
|
-
/**
|
|
1316
|
-
* Run retrieval only when system decides it is necessary.
|
|
1317
|
-
*/
|
|
1318
|
-
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1319
|
-
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
1320
1344
|
/** The environment being operated. */
|
|
1321
1345
|
var Environment;
|
|
1322
1346
|
(function (Environment) {
|
|
@@ -1329,30 +1353,6 @@ var Environment;
|
|
|
1329
1353
|
*/
|
|
1330
1354
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
1331
1355
|
})(Environment || (Environment = {}));
|
|
1332
|
-
/** Config for the function calling config mode. */
|
|
1333
|
-
var FunctionCallingConfigMode;
|
|
1334
|
-
(function (FunctionCallingConfigMode) {
|
|
1335
|
-
/**
|
|
1336
|
-
* The function calling config mode is unspecified. Should not be used.
|
|
1337
|
-
*/
|
|
1338
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1339
|
-
/**
|
|
1340
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
1341
|
-
*/
|
|
1342
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
1343
|
-
/**
|
|
1344
|
-
* 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".
|
|
1345
|
-
*/
|
|
1346
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1347
|
-
/**
|
|
1348
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1349
|
-
*/
|
|
1350
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1351
|
-
/**
|
|
1352
|
-
* 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".
|
|
1353
|
-
*/
|
|
1354
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1355
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
1356
1356
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
1357
1357
|
var SafetyFilterLevel;
|
|
1358
1358
|
(function (SafetyFilterLevel) {
|
|
@@ -1549,6 +1549,7 @@ var FileSource;
|
|
|
1549
1549
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1550
1550
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1551
1551
|
FileSource["GENERATED"] = "GENERATED";
|
|
1552
|
+
FileSource["REGISTERED"] = "REGISTERED";
|
|
1552
1553
|
})(FileSource || (FileSource = {}));
|
|
1553
1554
|
/** The reason why the turn is complete. */
|
|
1554
1555
|
var TurnCompleteReason;
|
|
@@ -3978,16 +3979,16 @@ function functionCallToMldev$4(fromObject) {
|
|
|
3978
3979
|
}
|
|
3979
3980
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
3980
3981
|
const toObject = {};
|
|
3981
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3982
|
-
if (fromMode != null) {
|
|
3983
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3984
|
-
}
|
|
3985
3982
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3986
3983
|
'allowedFunctionNames',
|
|
3987
3984
|
]);
|
|
3988
3985
|
if (fromAllowedFunctionNames != null) {
|
|
3989
3986
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3990
3987
|
}
|
|
3988
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3989
|
+
if (fromMode != null) {
|
|
3990
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3991
|
+
}
|
|
3991
3992
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
3992
3993
|
undefined) {
|
|
3993
3994
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -4247,6 +4248,9 @@ function imageConfigToMldev$1(fromObject) {
|
|
|
4247
4248
|
if (fromImageSize != null) {
|
|
4248
4249
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
4249
4250
|
}
|
|
4251
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
4252
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
4253
|
+
}
|
|
4250
4254
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
4251
4255
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
4252
4256
|
}
|
|
@@ -4472,43 +4476,25 @@ function safetySettingToMldev$1(fromObject) {
|
|
|
4472
4476
|
}
|
|
4473
4477
|
function toolConfigToMldev$2(fromObject) {
|
|
4474
4478
|
const toObject = {};
|
|
4475
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4476
|
-
'functionCallingConfig',
|
|
4477
|
-
]);
|
|
4478
|
-
if (fromFunctionCallingConfig != null) {
|
|
4479
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4480
|
-
}
|
|
4481
4479
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
4482
4480
|
'retrievalConfig',
|
|
4483
4481
|
]);
|
|
4484
4482
|
if (fromRetrievalConfig != null) {
|
|
4485
4483
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
4486
4484
|
}
|
|
4485
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4486
|
+
'functionCallingConfig',
|
|
4487
|
+
]);
|
|
4488
|
+
if (fromFunctionCallingConfig != null) {
|
|
4489
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4490
|
+
}
|
|
4487
4491
|
return toObject;
|
|
4488
4492
|
}
|
|
4489
4493
|
function toolToMldev$4(fromObject) {
|
|
4490
4494
|
const toObject = {};
|
|
4491
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4492
|
-
'functionDeclarations',
|
|
4493
|
-
]);
|
|
4494
|
-
if (fromFunctionDeclarations != null) {
|
|
4495
|
-
let transformedList = fromFunctionDeclarations;
|
|
4496
|
-
if (Array.isArray(transformedList)) {
|
|
4497
|
-
transformedList = transformedList.map((item) => {
|
|
4498
|
-
return item;
|
|
4499
|
-
});
|
|
4500
|
-
}
|
|
4501
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4502
|
-
}
|
|
4503
4495
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4504
4496
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4505
4497
|
}
|
|
4506
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4507
|
-
'googleSearchRetrieval',
|
|
4508
|
-
]);
|
|
4509
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
4510
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4511
|
-
}
|
|
4512
4498
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4513
4499
|
if (fromComputerUse != null) {
|
|
4514
4500
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -4526,6 +4512,18 @@ function toolToMldev$4(fromObject) {
|
|
|
4526
4512
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4527
4513
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4528
4514
|
}
|
|
4515
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4516
|
+
'functionDeclarations',
|
|
4517
|
+
]);
|
|
4518
|
+
if (fromFunctionDeclarations != null) {
|
|
4519
|
+
let transformedList = fromFunctionDeclarations;
|
|
4520
|
+
if (Array.isArray(transformedList)) {
|
|
4521
|
+
transformedList = transformedList.map((item) => {
|
|
4522
|
+
return item;
|
|
4523
|
+
});
|
|
4524
|
+
}
|
|
4525
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4526
|
+
}
|
|
4529
4527
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4530
4528
|
if (fromGoogleMaps != null) {
|
|
4531
4529
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
@@ -4534,6 +4532,12 @@ function toolToMldev$4(fromObject) {
|
|
|
4534
4532
|
if (fromGoogleSearch != null) {
|
|
4535
4533
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4536
4534
|
}
|
|
4535
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4536
|
+
'googleSearchRetrieval',
|
|
4537
|
+
]);
|
|
4538
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
4539
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4540
|
+
}
|
|
4537
4541
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4538
4542
|
if (fromUrlContext != null) {
|
|
4539
4543
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5464,16 +5468,16 @@ function functionCallToMldev$3(fromObject) {
|
|
|
5464
5468
|
}
|
|
5465
5469
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
5466
5470
|
const toObject = {};
|
|
5467
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5468
|
-
if (fromMode != null) {
|
|
5469
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
5470
|
-
}
|
|
5471
5471
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
5472
5472
|
'allowedFunctionNames',
|
|
5473
5473
|
]);
|
|
5474
5474
|
if (fromAllowedFunctionNames != null) {
|
|
5475
5475
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
5476
5476
|
}
|
|
5477
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5478
|
+
if (fromMode != null) {
|
|
5479
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
5480
|
+
}
|
|
5477
5481
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
5478
5482
|
undefined) {
|
|
5479
5483
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -5482,9 +5486,6 @@ function functionCallingConfigToMldev$1(fromObject) {
|
|
|
5482
5486
|
}
|
|
5483
5487
|
function functionDeclarationToVertex$2(fromObject) {
|
|
5484
5488
|
const toObject = {};
|
|
5485
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5486
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5487
|
-
}
|
|
5488
5489
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5489
5490
|
if (fromDescription != null) {
|
|
5490
5491
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -5513,6 +5514,9 @@ function functionDeclarationToVertex$2(fromObject) {
|
|
|
5513
5514
|
if (fromResponseJsonSchema != null) {
|
|
5514
5515
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
5515
5516
|
}
|
|
5517
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5518
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5519
|
+
}
|
|
5516
5520
|
return toObject;
|
|
5517
5521
|
}
|
|
5518
5522
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
@@ -5716,43 +5720,25 @@ function partToMldev$3(fromObject) {
|
|
|
5716
5720
|
}
|
|
5717
5721
|
function toolConfigToMldev$1(fromObject) {
|
|
5718
5722
|
const toObject = {};
|
|
5719
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5720
|
-
'functionCallingConfig',
|
|
5721
|
-
]);
|
|
5722
|
-
if (fromFunctionCallingConfig != null) {
|
|
5723
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5724
|
-
}
|
|
5725
5723
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
5726
5724
|
'retrievalConfig',
|
|
5727
5725
|
]);
|
|
5728
5726
|
if (fromRetrievalConfig != null) {
|
|
5729
5727
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
5730
5728
|
}
|
|
5729
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5730
|
+
'functionCallingConfig',
|
|
5731
|
+
]);
|
|
5732
|
+
if (fromFunctionCallingConfig != null) {
|
|
5733
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5734
|
+
}
|
|
5731
5735
|
return toObject;
|
|
5732
5736
|
}
|
|
5733
5737
|
function toolToMldev$3(fromObject) {
|
|
5734
5738
|
const toObject = {};
|
|
5735
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5736
|
-
'functionDeclarations',
|
|
5737
|
-
]);
|
|
5738
|
-
if (fromFunctionDeclarations != null) {
|
|
5739
|
-
let transformedList = fromFunctionDeclarations;
|
|
5740
|
-
if (Array.isArray(transformedList)) {
|
|
5741
|
-
transformedList = transformedList.map((item) => {
|
|
5742
|
-
return item;
|
|
5743
|
-
});
|
|
5744
|
-
}
|
|
5745
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5746
|
-
}
|
|
5747
5739
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5748
5740
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5749
5741
|
}
|
|
5750
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5751
|
-
'googleSearchRetrieval',
|
|
5752
|
-
]);
|
|
5753
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5754
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5755
|
-
}
|
|
5756
5742
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5757
5743
|
if (fromComputerUse != null) {
|
|
5758
5744
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5770,6 +5756,18 @@ function toolToMldev$3(fromObject) {
|
|
|
5770
5756
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5771
5757
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5772
5758
|
}
|
|
5759
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5760
|
+
'functionDeclarations',
|
|
5761
|
+
]);
|
|
5762
|
+
if (fromFunctionDeclarations != null) {
|
|
5763
|
+
let transformedList = fromFunctionDeclarations;
|
|
5764
|
+
if (Array.isArray(transformedList)) {
|
|
5765
|
+
transformedList = transformedList.map((item) => {
|
|
5766
|
+
return item;
|
|
5767
|
+
});
|
|
5768
|
+
}
|
|
5769
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5770
|
+
}
|
|
5773
5771
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5774
5772
|
if (fromGoogleMaps != null) {
|
|
5775
5773
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
@@ -5778,6 +5776,12 @@ function toolToMldev$3(fromObject) {
|
|
|
5778
5776
|
if (fromGoogleSearch != null) {
|
|
5779
5777
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5780
5778
|
}
|
|
5779
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5780
|
+
'googleSearchRetrieval',
|
|
5781
|
+
]);
|
|
5782
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5783
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5784
|
+
}
|
|
5781
5785
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5782
5786
|
if (fromUrlContext != null) {
|
|
5783
5787
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5786,28 +5790,10 @@ function toolToMldev$3(fromObject) {
|
|
|
5786
5790
|
}
|
|
5787
5791
|
function toolToVertex$2(fromObject) {
|
|
5788
5792
|
const toObject = {};
|
|
5789
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5790
|
-
'functionDeclarations',
|
|
5791
|
-
]);
|
|
5792
|
-
if (fromFunctionDeclarations != null) {
|
|
5793
|
-
let transformedList = fromFunctionDeclarations;
|
|
5794
|
-
if (Array.isArray(transformedList)) {
|
|
5795
|
-
transformedList = transformedList.map((item) => {
|
|
5796
|
-
return functionDeclarationToVertex$2(item);
|
|
5797
|
-
});
|
|
5798
|
-
}
|
|
5799
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5800
|
-
}
|
|
5801
5793
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
5802
5794
|
if (fromRetrieval != null) {
|
|
5803
5795
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
5804
5796
|
}
|
|
5805
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5806
|
-
'googleSearchRetrieval',
|
|
5807
|
-
]);
|
|
5808
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5809
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5810
|
-
}
|
|
5811
5797
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5812
5798
|
if (fromComputerUse != null) {
|
|
5813
5799
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5827,6 +5813,18 @@ function toolToVertex$2(fromObject) {
|
|
|
5827
5813
|
if (fromEnterpriseWebSearch != null) {
|
|
5828
5814
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
5829
5815
|
}
|
|
5816
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5817
|
+
'functionDeclarations',
|
|
5818
|
+
]);
|
|
5819
|
+
if (fromFunctionDeclarations != null) {
|
|
5820
|
+
let transformedList = fromFunctionDeclarations;
|
|
5821
|
+
if (Array.isArray(transformedList)) {
|
|
5822
|
+
transformedList = transformedList.map((item) => {
|
|
5823
|
+
return functionDeclarationToVertex$2(item);
|
|
5824
|
+
});
|
|
5825
|
+
}
|
|
5826
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5827
|
+
}
|
|
5830
5828
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5831
5829
|
if (fromGoogleMaps != null) {
|
|
5832
5830
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -5835,6 +5833,12 @@ function toolToVertex$2(fromObject) {
|
|
|
5835
5833
|
if (fromGoogleSearch != null) {
|
|
5836
5834
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5837
5835
|
}
|
|
5836
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5837
|
+
'googleSearchRetrieval',
|
|
5838
|
+
]);
|
|
5839
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5840
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5841
|
+
}
|
|
5838
5842
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5839
5843
|
if (fromUrlContext != null) {
|
|
5840
5844
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -7126,9 +7130,6 @@ function functionCallToMldev$2(fromObject) {
|
|
|
7126
7130
|
}
|
|
7127
7131
|
function functionDeclarationToVertex$1(fromObject) {
|
|
7128
7132
|
const toObject = {};
|
|
7129
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
7130
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
7131
|
-
}
|
|
7132
7133
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
7133
7134
|
if (fromDescription != null) {
|
|
7134
7135
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -7157,6 +7158,9 @@ function functionDeclarationToVertex$1(fromObject) {
|
|
|
7157
7158
|
if (fromResponseJsonSchema != null) {
|
|
7158
7159
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
7159
7160
|
}
|
|
7161
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
7162
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
7163
|
+
}
|
|
7160
7164
|
return toObject;
|
|
7161
7165
|
}
|
|
7162
7166
|
function generationConfigToVertex$1(fromObject) {
|
|
@@ -7255,7 +7259,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7255
7259
|
}
|
|
7256
7260
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7257
7261
|
if (fromSpeechConfig != null) {
|
|
7258
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
7262
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
7259
7263
|
}
|
|
7260
7264
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
7261
7265
|
'stopSequences',
|
|
@@ -7471,7 +7475,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
7471
7475
|
}
|
|
7472
7476
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7473
7477
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
7474
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'],
|
|
7478
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
7475
7479
|
}
|
|
7476
7480
|
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
7477
7481
|
'thinkingConfig',
|
|
@@ -7796,44 +7800,11 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
7796
7800
|
}
|
|
7797
7801
|
return toObject;
|
|
7798
7802
|
}
|
|
7799
|
-
function speechConfigToVertex$1(fromObject) {
|
|
7800
|
-
const toObject = {};
|
|
7801
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7802
|
-
if (fromVoiceConfig != null) {
|
|
7803
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
7804
|
-
}
|
|
7805
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7806
|
-
if (fromLanguageCode != null) {
|
|
7807
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
7808
|
-
}
|
|
7809
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
7810
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
7811
|
-
}
|
|
7812
|
-
return toObject;
|
|
7813
|
-
}
|
|
7814
7803
|
function toolToMldev$2(fromObject) {
|
|
7815
7804
|
const toObject = {};
|
|
7816
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7817
|
-
'functionDeclarations',
|
|
7818
|
-
]);
|
|
7819
|
-
if (fromFunctionDeclarations != null) {
|
|
7820
|
-
let transformedList = fromFunctionDeclarations;
|
|
7821
|
-
if (Array.isArray(transformedList)) {
|
|
7822
|
-
transformedList = transformedList.map((item) => {
|
|
7823
|
-
return item;
|
|
7824
|
-
});
|
|
7825
|
-
}
|
|
7826
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7827
|
-
}
|
|
7828
7805
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
7829
7806
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
7830
7807
|
}
|
|
7831
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7832
|
-
'googleSearchRetrieval',
|
|
7833
|
-
]);
|
|
7834
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
7835
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7836
|
-
}
|
|
7837
7808
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7838
7809
|
if (fromComputerUse != null) {
|
|
7839
7810
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -7851,6 +7822,18 @@ function toolToMldev$2(fromObject) {
|
|
|
7851
7822
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7852
7823
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
7853
7824
|
}
|
|
7825
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7826
|
+
'functionDeclarations',
|
|
7827
|
+
]);
|
|
7828
|
+
if (fromFunctionDeclarations != null) {
|
|
7829
|
+
let transformedList = fromFunctionDeclarations;
|
|
7830
|
+
if (Array.isArray(transformedList)) {
|
|
7831
|
+
transformedList = transformedList.map((item) => {
|
|
7832
|
+
return item;
|
|
7833
|
+
});
|
|
7834
|
+
}
|
|
7835
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7836
|
+
}
|
|
7854
7837
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
7855
7838
|
if (fromGoogleMaps != null) {
|
|
7856
7839
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
@@ -7859,6 +7842,12 @@ function toolToMldev$2(fromObject) {
|
|
|
7859
7842
|
if (fromGoogleSearch != null) {
|
|
7860
7843
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
7861
7844
|
}
|
|
7845
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7846
|
+
'googleSearchRetrieval',
|
|
7847
|
+
]);
|
|
7848
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
7849
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7850
|
+
}
|
|
7862
7851
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7863
7852
|
if (fromUrlContext != null) {
|
|
7864
7853
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -7867,28 +7856,10 @@ function toolToMldev$2(fromObject) {
|
|
|
7867
7856
|
}
|
|
7868
7857
|
function toolToVertex$1(fromObject) {
|
|
7869
7858
|
const toObject = {};
|
|
7870
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7871
|
-
'functionDeclarations',
|
|
7872
|
-
]);
|
|
7873
|
-
if (fromFunctionDeclarations != null) {
|
|
7874
|
-
let transformedList = fromFunctionDeclarations;
|
|
7875
|
-
if (Array.isArray(transformedList)) {
|
|
7876
|
-
transformedList = transformedList.map((item) => {
|
|
7877
|
-
return functionDeclarationToVertex$1(item);
|
|
7878
|
-
});
|
|
7879
|
-
}
|
|
7880
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7881
|
-
}
|
|
7882
7859
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
7883
7860
|
if (fromRetrieval != null) {
|
|
7884
7861
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
7885
7862
|
}
|
|
7886
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7887
|
-
'googleSearchRetrieval',
|
|
7888
|
-
]);
|
|
7889
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
7890
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7891
|
-
}
|
|
7892
7863
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7893
7864
|
if (fromComputerUse != null) {
|
|
7894
7865
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -7908,6 +7879,18 @@ function toolToVertex$1(fromObject) {
|
|
|
7908
7879
|
if (fromEnterpriseWebSearch != null) {
|
|
7909
7880
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
7910
7881
|
}
|
|
7882
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7883
|
+
'functionDeclarations',
|
|
7884
|
+
]);
|
|
7885
|
+
if (fromFunctionDeclarations != null) {
|
|
7886
|
+
let transformedList = fromFunctionDeclarations;
|
|
7887
|
+
if (Array.isArray(transformedList)) {
|
|
7888
|
+
transformedList = transformedList.map((item) => {
|
|
7889
|
+
return functionDeclarationToVertex$1(item);
|
|
7890
|
+
});
|
|
7891
|
+
}
|
|
7892
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7893
|
+
}
|
|
7911
7894
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
7912
7895
|
if (fromGoogleMaps != null) {
|
|
7913
7896
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -7916,6 +7899,12 @@ function toolToVertex$1(fromObject) {
|
|
|
7916
7899
|
if (fromGoogleSearch != null) {
|
|
7917
7900
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
7918
7901
|
}
|
|
7902
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7903
|
+
'googleSearchRetrieval',
|
|
7904
|
+
]);
|
|
7905
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
7906
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7907
|
+
}
|
|
7919
7908
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7920
7909
|
if (fromUrlContext != null) {
|
|
7921
7910
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -8698,16 +8687,16 @@ function functionCallToMldev$1(fromObject) {
|
|
|
8698
8687
|
}
|
|
8699
8688
|
function functionCallingConfigToMldev(fromObject) {
|
|
8700
8689
|
const toObject = {};
|
|
8701
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8702
|
-
if (fromMode != null) {
|
|
8703
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
8704
|
-
}
|
|
8705
8690
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
8706
8691
|
'allowedFunctionNames',
|
|
8707
8692
|
]);
|
|
8708
8693
|
if (fromAllowedFunctionNames != null) {
|
|
8709
8694
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
8710
8695
|
}
|
|
8696
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8697
|
+
if (fromMode != null) {
|
|
8698
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
8699
|
+
}
|
|
8711
8700
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
8712
8701
|
undefined) {
|
|
8713
8702
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -8716,9 +8705,6 @@ function functionCallingConfigToMldev(fromObject) {
|
|
|
8716
8705
|
}
|
|
8717
8706
|
function functionDeclarationToVertex(fromObject) {
|
|
8718
8707
|
const toObject = {};
|
|
8719
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
8720
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
8721
|
-
}
|
|
8722
8708
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
8723
8709
|
if (fromDescription != null) {
|
|
8724
8710
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -8747,6 +8733,9 @@ function functionDeclarationToVertex(fromObject) {
|
|
|
8747
8733
|
if (fromResponseJsonSchema != null) {
|
|
8748
8734
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
8749
8735
|
}
|
|
8736
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
8737
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
8738
|
+
}
|
|
8750
8739
|
return toObject;
|
|
8751
8740
|
}
|
|
8752
8741
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -9053,7 +9042,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9053
9042
|
}
|
|
9054
9043
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
9055
9044
|
if (fromSpeechConfig != null) {
|
|
9056
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
9045
|
+
setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
|
|
9057
9046
|
}
|
|
9058
9047
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
9059
9048
|
'audioTimestamp',
|
|
@@ -9999,7 +9988,7 @@ function generationConfigToVertex(fromObject) {
|
|
|
9999
9988
|
}
|
|
10000
9989
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
10001
9990
|
if (fromSpeechConfig != null) {
|
|
10002
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
9991
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
10003
9992
|
}
|
|
10004
9993
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
10005
9994
|
'stopSequences',
|
|
@@ -10084,6 +10073,9 @@ function imageConfigToMldev(fromObject) {
|
|
|
10084
10073
|
if (fromImageSize != null) {
|
|
10085
10074
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
10086
10075
|
}
|
|
10076
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
10077
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
10078
|
+
}
|
|
10087
10079
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
10088
10080
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
10089
10081
|
}
|
|
@@ -10103,6 +10095,12 @@ function imageConfigToVertex(fromObject) {
|
|
|
10103
10095
|
if (fromImageSize != null) {
|
|
10104
10096
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
10105
10097
|
}
|
|
10098
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
10099
|
+
'personGeneration',
|
|
10100
|
+
]);
|
|
10101
|
+
if (fromPersonGeneration != null) {
|
|
10102
|
+
setValueByPath(toObject, ['personGeneration'], fromPersonGeneration);
|
|
10103
|
+
}
|
|
10106
10104
|
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
10107
10105
|
'outputMimeType',
|
|
10108
10106
|
]);
|
|
@@ -10801,60 +10799,27 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
10801
10799
|
}
|
|
10802
10800
|
return toObject;
|
|
10803
10801
|
}
|
|
10804
|
-
function speechConfigToVertex(fromObject) {
|
|
10805
|
-
const toObject = {};
|
|
10806
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
10807
|
-
if (fromVoiceConfig != null) {
|
|
10808
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
10809
|
-
}
|
|
10810
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
10811
|
-
if (fromLanguageCode != null) {
|
|
10812
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
10813
|
-
}
|
|
10814
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
10815
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
10816
|
-
}
|
|
10817
|
-
return toObject;
|
|
10818
|
-
}
|
|
10819
10802
|
function toolConfigToMldev(fromObject) {
|
|
10820
10803
|
const toObject = {};
|
|
10821
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
10822
|
-
'functionCallingConfig',
|
|
10823
|
-
]);
|
|
10824
|
-
if (fromFunctionCallingConfig != null) {
|
|
10825
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
10826
|
-
}
|
|
10827
10804
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
10828
10805
|
'retrievalConfig',
|
|
10829
10806
|
]);
|
|
10830
10807
|
if (fromRetrievalConfig != null) {
|
|
10831
10808
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
10832
10809
|
}
|
|
10810
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
10811
|
+
'functionCallingConfig',
|
|
10812
|
+
]);
|
|
10813
|
+
if (fromFunctionCallingConfig != null) {
|
|
10814
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
10815
|
+
}
|
|
10833
10816
|
return toObject;
|
|
10834
10817
|
}
|
|
10835
10818
|
function toolToMldev$1(fromObject) {
|
|
10836
10819
|
const toObject = {};
|
|
10837
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10838
|
-
'functionDeclarations',
|
|
10839
|
-
]);
|
|
10840
|
-
if (fromFunctionDeclarations != null) {
|
|
10841
|
-
let transformedList = fromFunctionDeclarations;
|
|
10842
|
-
if (Array.isArray(transformedList)) {
|
|
10843
|
-
transformedList = transformedList.map((item) => {
|
|
10844
|
-
return item;
|
|
10845
|
-
});
|
|
10846
|
-
}
|
|
10847
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10848
|
-
}
|
|
10849
10820
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
10850
10821
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
10851
10822
|
}
|
|
10852
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10853
|
-
'googleSearchRetrieval',
|
|
10854
|
-
]);
|
|
10855
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
10856
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10857
|
-
}
|
|
10858
10823
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10859
10824
|
if (fromComputerUse != null) {
|
|
10860
10825
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -10872,6 +10837,18 @@ function toolToMldev$1(fromObject) {
|
|
|
10872
10837
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
10873
10838
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
10874
10839
|
}
|
|
10840
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10841
|
+
'functionDeclarations',
|
|
10842
|
+
]);
|
|
10843
|
+
if (fromFunctionDeclarations != null) {
|
|
10844
|
+
let transformedList = fromFunctionDeclarations;
|
|
10845
|
+
if (Array.isArray(transformedList)) {
|
|
10846
|
+
transformedList = transformedList.map((item) => {
|
|
10847
|
+
return item;
|
|
10848
|
+
});
|
|
10849
|
+
}
|
|
10850
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10851
|
+
}
|
|
10875
10852
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10876
10853
|
if (fromGoogleMaps != null) {
|
|
10877
10854
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
@@ -10880,6 +10857,12 @@ function toolToMldev$1(fromObject) {
|
|
|
10880
10857
|
if (fromGoogleSearch != null) {
|
|
10881
10858
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
10882
10859
|
}
|
|
10860
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10861
|
+
'googleSearchRetrieval',
|
|
10862
|
+
]);
|
|
10863
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
10864
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10865
|
+
}
|
|
10883
10866
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10884
10867
|
if (fromUrlContext != null) {
|
|
10885
10868
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -10888,28 +10871,10 @@ function toolToMldev$1(fromObject) {
|
|
|
10888
10871
|
}
|
|
10889
10872
|
function toolToVertex(fromObject) {
|
|
10890
10873
|
const toObject = {};
|
|
10891
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10892
|
-
'functionDeclarations',
|
|
10893
|
-
]);
|
|
10894
|
-
if (fromFunctionDeclarations != null) {
|
|
10895
|
-
let transformedList = fromFunctionDeclarations;
|
|
10896
|
-
if (Array.isArray(transformedList)) {
|
|
10897
|
-
transformedList = transformedList.map((item) => {
|
|
10898
|
-
return functionDeclarationToVertex(item);
|
|
10899
|
-
});
|
|
10900
|
-
}
|
|
10901
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10902
|
-
}
|
|
10903
10874
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
10904
10875
|
if (fromRetrieval != null) {
|
|
10905
10876
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
10906
10877
|
}
|
|
10907
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10908
|
-
'googleSearchRetrieval',
|
|
10909
|
-
]);
|
|
10910
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
10911
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10912
|
-
}
|
|
10913
10878
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10914
10879
|
if (fromComputerUse != null) {
|
|
10915
10880
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -10929,6 +10894,18 @@ function toolToVertex(fromObject) {
|
|
|
10929
10894
|
if (fromEnterpriseWebSearch != null) {
|
|
10930
10895
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
10931
10896
|
}
|
|
10897
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10898
|
+
'functionDeclarations',
|
|
10899
|
+
]);
|
|
10900
|
+
if (fromFunctionDeclarations != null) {
|
|
10901
|
+
let transformedList = fromFunctionDeclarations;
|
|
10902
|
+
if (Array.isArray(transformedList)) {
|
|
10903
|
+
transformedList = transformedList.map((item) => {
|
|
10904
|
+
return functionDeclarationToVertex(item);
|
|
10905
|
+
});
|
|
10906
|
+
}
|
|
10907
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10908
|
+
}
|
|
10932
10909
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10933
10910
|
if (fromGoogleMaps != null) {
|
|
10934
10911
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -10937,6 +10914,12 @@ function toolToVertex(fromObject) {
|
|
|
10937
10914
|
if (fromGoogleSearch != null) {
|
|
10938
10915
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
10939
10916
|
}
|
|
10917
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10918
|
+
'googleSearchRetrieval',
|
|
10919
|
+
]);
|
|
10920
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
10921
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10922
|
+
}
|
|
10940
10923
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10941
10924
|
if (fromUrlContext != null) {
|
|
10942
10925
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -11497,7 +11480,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
11497
11480
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
11498
11481
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
11499
11482
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
11500
|
-
const SDK_VERSION = '1.
|
|
11483
|
+
const SDK_VERSION = '1.35.0'; // x-release-please-version
|
|
11501
11484
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
11502
11485
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
11503
11486
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11571,6 +11554,11 @@ class ApiClient {
|
|
|
11571
11554
|
getLocation() {
|
|
11572
11555
|
return this.clientOptions.location;
|
|
11573
11556
|
}
|
|
11557
|
+
async getAuthHeaders() {
|
|
11558
|
+
const headers = new Headers();
|
|
11559
|
+
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
11560
|
+
return headers;
|
|
11561
|
+
}
|
|
11574
11562
|
getApiVersion() {
|
|
11575
11563
|
if (this.clientOptions.httpOptions &&
|
|
11576
11564
|
this.clientOptions.httpOptions.apiVersion !== undefined) {
|
|
@@ -13206,7 +13194,7 @@ class Models extends BaseModule {
|
|
|
13206
13194
|
* @example
|
|
13207
13195
|
* ```ts
|
|
13208
13196
|
* const response = await client.models.generateImages({
|
|
13209
|
-
* model: 'imagen-
|
|
13197
|
+
* model: 'imagen-4.0-generate-001',
|
|
13210
13198
|
* prompt: 'Robot holding a red skateboard',
|
|
13211
13199
|
* config: {
|
|
13212
13200
|
* numberOfImages: 1,
|
|
@@ -13315,7 +13303,7 @@ class Models extends BaseModule {
|
|
|
13315
13303
|
* @example
|
|
13316
13304
|
* ```ts
|
|
13317
13305
|
* const response = await client.models.upscaleImage({
|
|
13318
|
-
* model: 'imagen-
|
|
13306
|
+
* model: 'imagen-4.0-upscale-preview',
|
|
13319
13307
|
* image: image,
|
|
13320
13308
|
* upscaleFactor: 'x2',
|
|
13321
13309
|
* config: {
|
|
@@ -13977,7 +13965,7 @@ class Models extends BaseModule {
|
|
|
13977
13965
|
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
13978
13966
|
*
|
|
13979
13967
|
* const response2 = await ai.models.recontextImage({
|
|
13980
|
-
* model: 'virtual-try-on-
|
|
13968
|
+
* model: 'virtual-try-on-001',
|
|
13981
13969
|
* source: {
|
|
13982
13970
|
* personImage: personImage,
|
|
13983
13971
|
* productImages: [productImage],
|
|
@@ -15059,27 +15047,9 @@ function sessionResumptionConfigToMldev(fromObject) {
|
|
|
15059
15047
|
}
|
|
15060
15048
|
function toolToMldev(fromObject) {
|
|
15061
15049
|
const toObject = {};
|
|
15062
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
15063
|
-
'functionDeclarations',
|
|
15064
|
-
]);
|
|
15065
|
-
if (fromFunctionDeclarations != null) {
|
|
15066
|
-
let transformedList = fromFunctionDeclarations;
|
|
15067
|
-
if (Array.isArray(transformedList)) {
|
|
15068
|
-
transformedList = transformedList.map((item) => {
|
|
15069
|
-
return item;
|
|
15070
|
-
});
|
|
15071
|
-
}
|
|
15072
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
15073
|
-
}
|
|
15074
15050
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
15075
15051
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
15076
15052
|
}
|
|
15077
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
15078
|
-
'googleSearchRetrieval',
|
|
15079
|
-
]);
|
|
15080
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
15081
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
15082
|
-
}
|
|
15083
15053
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
15084
15054
|
if (fromComputerUse != null) {
|
|
15085
15055
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -15097,6 +15067,18 @@ function toolToMldev(fromObject) {
|
|
|
15097
15067
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
15098
15068
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
15099
15069
|
}
|
|
15070
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
15071
|
+
'functionDeclarations',
|
|
15072
|
+
]);
|
|
15073
|
+
if (fromFunctionDeclarations != null) {
|
|
15074
|
+
let transformedList = fromFunctionDeclarations;
|
|
15075
|
+
if (Array.isArray(transformedList)) {
|
|
15076
|
+
transformedList = transformedList.map((item) => {
|
|
15077
|
+
return item;
|
|
15078
|
+
});
|
|
15079
|
+
}
|
|
15080
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
15081
|
+
}
|
|
15100
15082
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
15101
15083
|
if (fromGoogleMaps != null) {
|
|
15102
15084
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
@@ -15105,6 +15087,12 @@ function toolToMldev(fromObject) {
|
|
|
15105
15087
|
if (fromGoogleSearch != null) {
|
|
15106
15088
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
15107
15089
|
}
|
|
15090
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
15091
|
+
'googleSearchRetrieval',
|
|
15092
|
+
]);
|
|
15093
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
15094
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
15095
|
+
}
|
|
15108
15096
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
15109
15097
|
if (fromUrlContext != null) {
|
|
15110
15098
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -17443,7 +17431,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17443
17431
|
*/
|
|
17444
17432
|
constructor(_b) {
|
|
17445
17433
|
var _c, _d, _e, _f, _g, _h, _j;
|
|
17446
|
-
var
|
|
17434
|
+
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"]);
|
|
17447
17435
|
const options = Object.assign(Object.assign({ apiKey,
|
|
17448
17436
|
apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
|
|
17449
17437
|
this.baseURL = options.baseURL;
|
|
@@ -17461,6 +17449,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17461
17449
|
this._options = options;
|
|
17462
17450
|
this.apiKey = apiKey;
|
|
17463
17451
|
this.apiVersion = apiVersion;
|
|
17452
|
+
this.clientAdapter = options.clientAdapter;
|
|
17464
17453
|
}
|
|
17465
17454
|
/**
|
|
17466
17455
|
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
@@ -17479,6 +17468,10 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17479
17468
|
return this._options.defaultQuery;
|
|
17480
17469
|
}
|
|
17481
17470
|
validateHeaders({ values, nulls }) {
|
|
17471
|
+
// The headers object handles case insensitivity.
|
|
17472
|
+
if (values.has('authorization') || values.has('x-goog-api-key')) {
|
|
17473
|
+
return;
|
|
17474
|
+
}
|
|
17482
17475
|
if (this.apiKey && values.get('x-goog-api-key')) {
|
|
17483
17476
|
return;
|
|
17484
17477
|
}
|
|
@@ -17488,10 +17481,17 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17488
17481
|
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');
|
|
17489
17482
|
}
|
|
17490
17483
|
async authHeaders(opts) {
|
|
17491
|
-
|
|
17484
|
+
const existingHeaders = buildHeaders([opts.headers]);
|
|
17485
|
+
if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
|
|
17492
17486
|
return undefined;
|
|
17493
17487
|
}
|
|
17494
|
-
|
|
17488
|
+
if (this.apiKey) {
|
|
17489
|
+
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
17490
|
+
}
|
|
17491
|
+
if (this.clientAdapter.isVertexAI()) {
|
|
17492
|
+
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
17493
|
+
}
|
|
17494
|
+
return undefined;
|
|
17495
17495
|
}
|
|
17496
17496
|
/**
|
|
17497
17497
|
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
@@ -17535,8 +17535,16 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17535
17535
|
}
|
|
17536
17536
|
/**
|
|
17537
17537
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
17538
|
+
|
|
17538
17539
|
*/
|
|
17539
|
-
async prepareOptions(options) {
|
|
17540
|
+
async prepareOptions(options) {
|
|
17541
|
+
if (this.clientAdapter &&
|
|
17542
|
+
this.clientAdapter.isVertexAI() &&
|
|
17543
|
+
!options.path.startsWith(`/${this.apiVersion}/projects/`)) {
|
|
17544
|
+
const oldPath = options.path.slice(this.apiVersion.length + 1);
|
|
17545
|
+
options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
|
|
17546
|
+
}
|
|
17547
|
+
}
|
|
17540
17548
|
/**
|
|
17541
17549
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
17542
17550
|
*
|
|
@@ -17778,13 +17786,14 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17778
17786
|
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
17779
17787
|
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
17780
17788
|
}
|
|
17781
|
-
const
|
|
17789
|
+
const authHeaders = await this.authHeaders(options);
|
|
17790
|
+
let headers = buildHeaders([
|
|
17782
17791
|
idempotencyHeaders,
|
|
17783
17792
|
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()),
|
|
17784
|
-
await this.authHeaders(options),
|
|
17785
17793
|
this._options.defaultHeaders,
|
|
17786
17794
|
bodyHeaders,
|
|
17787
17795
|
options.headers,
|
|
17796
|
+
authHeaders,
|
|
17788
17797
|
]);
|
|
17789
17798
|
this.validateHeaders(headers);
|
|
17790
17799
|
return headers.values;
|
|
@@ -19450,9 +19459,6 @@ class GoogleGenAI {
|
|
|
19450
19459
|
return this._interactions;
|
|
19451
19460
|
}
|
|
19452
19461
|
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
19453
|
-
if (this.vertexai) {
|
|
19454
|
-
throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
|
|
19455
|
-
}
|
|
19456
19462
|
const httpOpts = this.httpOptions;
|
|
19457
19463
|
// Unsupported Options Warnings
|
|
19458
19464
|
if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
|
|
@@ -19461,6 +19467,8 @@ class GoogleGenAI {
|
|
|
19461
19467
|
const nextGenClient = new GeminiNextGenAPIClient({
|
|
19462
19468
|
baseURL: this.apiClient.getBaseUrl(),
|
|
19463
19469
|
apiKey: this.apiKey,
|
|
19470
|
+
apiVersion: this.apiClient.getApiVersion(),
|
|
19471
|
+
clientAdapter: this.apiClient,
|
|
19464
19472
|
defaultHeaders: this.apiClient.getDefaultHeaders(),
|
|
19465
19473
|
timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
|
|
19466
19474
|
});
|
|
@@ -19574,5 +19582,5 @@ function getApiKeyFromEnv() {
|
|
|
19574
19582
|
return envGoogleApiKey || envGeminiApiKey || undefined;
|
|
19575
19583
|
}
|
|
19576
19584
|
|
|
19577
|
-
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality,
|
|
19585
|
+
export { ActivityHandling, AdapterSize, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, Environment, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, RawReferenceImage, RecontextImageResponse, ReplayResponse, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, TrafficType, TuningMethod, TuningMode, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
19578
19586
|
//# sourceMappingURL=index.mjs.map
|