@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/web/index.mjs
CHANGED
|
@@ -672,18 +672,6 @@ var Type;
|
|
|
672
672
|
*/
|
|
673
673
|
Type["NULL"] = "NULL";
|
|
674
674
|
})(Type || (Type = {}));
|
|
675
|
-
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
676
|
-
var Mode;
|
|
677
|
-
(function (Mode) {
|
|
678
|
-
/**
|
|
679
|
-
* Always trigger retrieval.
|
|
680
|
-
*/
|
|
681
|
-
Mode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
682
|
-
/**
|
|
683
|
-
* Run retrieval only when system decides it is necessary.
|
|
684
|
-
*/
|
|
685
|
-
Mode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
686
|
-
})(Mode || (Mode = {}));
|
|
687
675
|
/** The API spec that the external API implements. This enum is not supported in Gemini API. */
|
|
688
676
|
var ApiSpec;
|
|
689
677
|
(function (ApiSpec) {
|
|
@@ -786,21 +774,81 @@ var PhishBlockThreshold;
|
|
|
786
774
|
*/
|
|
787
775
|
PhishBlockThreshold["BLOCK_ONLY_EXTREMELY_HIGH"] = "BLOCK_ONLY_EXTREMELY_HIGH";
|
|
788
776
|
})(PhishBlockThreshold || (PhishBlockThreshold = {}));
|
|
789
|
-
/**
|
|
777
|
+
/** Specifies the function Behavior. Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI. */
|
|
778
|
+
var Behavior;
|
|
779
|
+
(function (Behavior) {
|
|
780
|
+
/**
|
|
781
|
+
* This value is unused.
|
|
782
|
+
*/
|
|
783
|
+
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
784
|
+
/**
|
|
785
|
+
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
786
|
+
*/
|
|
787
|
+
Behavior["BLOCKING"] = "BLOCKING";
|
|
788
|
+
/**
|
|
789
|
+
* 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.
|
|
790
|
+
*/
|
|
791
|
+
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
792
|
+
})(Behavior || (Behavior = {}));
|
|
793
|
+
/** The mode of the predictor to be used in dynamic retrieval. */
|
|
794
|
+
var DynamicRetrievalConfigMode;
|
|
795
|
+
(function (DynamicRetrievalConfigMode) {
|
|
796
|
+
/**
|
|
797
|
+
* Always trigger retrieval.
|
|
798
|
+
*/
|
|
799
|
+
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
800
|
+
/**
|
|
801
|
+
* Run retrieval only when system decides it is necessary.
|
|
802
|
+
*/
|
|
803
|
+
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
804
|
+
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
805
|
+
/** Function calling mode. */
|
|
806
|
+
var FunctionCallingConfigMode;
|
|
807
|
+
(function (FunctionCallingConfigMode) {
|
|
808
|
+
/**
|
|
809
|
+
* Unspecified function calling mode. This value should not be used.
|
|
810
|
+
*/
|
|
811
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
812
|
+
/**
|
|
813
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
814
|
+
*/
|
|
815
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
816
|
+
/**
|
|
817
|
+
* 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".
|
|
818
|
+
*/
|
|
819
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
820
|
+
/**
|
|
821
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
822
|
+
*/
|
|
823
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
824
|
+
/**
|
|
825
|
+
* 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".
|
|
826
|
+
*/
|
|
827
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
828
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
829
|
+
/** The number of thoughts tokens that the model should generate. */
|
|
790
830
|
var ThinkingLevel;
|
|
791
831
|
(function (ThinkingLevel) {
|
|
792
832
|
/**
|
|
793
|
-
*
|
|
833
|
+
* Unspecified thinking level.
|
|
794
834
|
*/
|
|
795
835
|
ThinkingLevel["THINKING_LEVEL_UNSPECIFIED"] = "THINKING_LEVEL_UNSPECIFIED";
|
|
796
836
|
/**
|
|
797
837
|
* Low thinking level.
|
|
798
838
|
*/
|
|
799
839
|
ThinkingLevel["LOW"] = "LOW";
|
|
840
|
+
/**
|
|
841
|
+
* Medium thinking level.
|
|
842
|
+
*/
|
|
843
|
+
ThinkingLevel["MEDIUM"] = "MEDIUM";
|
|
800
844
|
/**
|
|
801
845
|
* High thinking level.
|
|
802
846
|
*/
|
|
803
847
|
ThinkingLevel["HIGH"] = "HIGH";
|
|
848
|
+
/**
|
|
849
|
+
* MINIMAL thinking level.
|
|
850
|
+
*/
|
|
851
|
+
ThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
804
852
|
})(ThinkingLevel || (ThinkingLevel = {}));
|
|
805
853
|
/** Harm category. */
|
|
806
854
|
var HarmCategory;
|
|
@@ -1271,6 +1319,10 @@ var PartMediaResolutionLevel;
|
|
|
1271
1319
|
* Media resolution set to high.
|
|
1272
1320
|
*/
|
|
1273
1321
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1322
|
+
/**
|
|
1323
|
+
* Media resolution set to ultra high.
|
|
1324
|
+
*/
|
|
1325
|
+
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
1274
1326
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
1275
1327
|
/** Options for feature selection preference. */
|
|
1276
1328
|
var FeatureSelectionPreference;
|
|
@@ -1280,34 +1332,6 @@ var FeatureSelectionPreference;
|
|
|
1280
1332
|
FeatureSelectionPreference["BALANCED"] = "BALANCED";
|
|
1281
1333
|
FeatureSelectionPreference["PRIORITIZE_COST"] = "PRIORITIZE_COST";
|
|
1282
1334
|
})(FeatureSelectionPreference || (FeatureSelectionPreference = {}));
|
|
1283
|
-
/** Defines the function behavior. Defaults to `BLOCKING`. */
|
|
1284
|
-
var Behavior;
|
|
1285
|
-
(function (Behavior) {
|
|
1286
|
-
/**
|
|
1287
|
-
* This value is unused.
|
|
1288
|
-
*/
|
|
1289
|
-
Behavior["UNSPECIFIED"] = "UNSPECIFIED";
|
|
1290
|
-
/**
|
|
1291
|
-
* If set, the system will wait to receive the function response before continuing the conversation.
|
|
1292
|
-
*/
|
|
1293
|
-
Behavior["BLOCKING"] = "BLOCKING";
|
|
1294
|
-
/**
|
|
1295
|
-
* 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.
|
|
1296
|
-
*/
|
|
1297
|
-
Behavior["NON_BLOCKING"] = "NON_BLOCKING";
|
|
1298
|
-
})(Behavior || (Behavior = {}));
|
|
1299
|
-
/** Config for the dynamic retrieval config mode. */
|
|
1300
|
-
var DynamicRetrievalConfigMode;
|
|
1301
|
-
(function (DynamicRetrievalConfigMode) {
|
|
1302
|
-
/**
|
|
1303
|
-
* Always trigger retrieval.
|
|
1304
|
-
*/
|
|
1305
|
-
DynamicRetrievalConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1306
|
-
/**
|
|
1307
|
-
* Run retrieval only when system decides it is necessary.
|
|
1308
|
-
*/
|
|
1309
|
-
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
1310
|
-
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
1311
1335
|
/** The environment being operated. */
|
|
1312
1336
|
var Environment;
|
|
1313
1337
|
(function (Environment) {
|
|
@@ -1320,30 +1344,6 @@ var Environment;
|
|
|
1320
1344
|
*/
|
|
1321
1345
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
1322
1346
|
})(Environment || (Environment = {}));
|
|
1323
|
-
/** Config for the function calling config mode. */
|
|
1324
|
-
var FunctionCallingConfigMode;
|
|
1325
|
-
(function (FunctionCallingConfigMode) {
|
|
1326
|
-
/**
|
|
1327
|
-
* The function calling config mode is unspecified. Should not be used.
|
|
1328
|
-
*/
|
|
1329
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
1330
|
-
/**
|
|
1331
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
1332
|
-
*/
|
|
1333
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
1334
|
-
/**
|
|
1335
|
-
* 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".
|
|
1336
|
-
*/
|
|
1337
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
1338
|
-
/**
|
|
1339
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
1340
|
-
*/
|
|
1341
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
1342
|
-
/**
|
|
1343
|
-
* 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".
|
|
1344
|
-
*/
|
|
1345
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
1346
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
1347
1347
|
/** Enum that controls the safety filter level for objectionable content. */
|
|
1348
1348
|
var SafetyFilterLevel;
|
|
1349
1349
|
(function (SafetyFilterLevel) {
|
|
@@ -1540,6 +1540,7 @@ var FileSource;
|
|
|
1540
1540
|
FileSource["SOURCE_UNSPECIFIED"] = "SOURCE_UNSPECIFIED";
|
|
1541
1541
|
FileSource["UPLOADED"] = "UPLOADED";
|
|
1542
1542
|
FileSource["GENERATED"] = "GENERATED";
|
|
1543
|
+
FileSource["REGISTERED"] = "REGISTERED";
|
|
1543
1544
|
})(FileSource || (FileSource = {}));
|
|
1544
1545
|
/** The reason why the turn is complete. */
|
|
1545
1546
|
var TurnCompleteReason;
|
|
@@ -3969,16 +3970,16 @@ function functionCallToMldev$4(fromObject) {
|
|
|
3969
3970
|
}
|
|
3970
3971
|
function functionCallingConfigToMldev$2(fromObject) {
|
|
3971
3972
|
const toObject = {};
|
|
3972
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3973
|
-
if (fromMode != null) {
|
|
3974
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
3975
|
-
}
|
|
3976
3973
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
3977
3974
|
'allowedFunctionNames',
|
|
3978
3975
|
]);
|
|
3979
3976
|
if (fromAllowedFunctionNames != null) {
|
|
3980
3977
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
3981
3978
|
}
|
|
3979
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
3980
|
+
if (fromMode != null) {
|
|
3981
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
3982
|
+
}
|
|
3982
3983
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
3983
3984
|
undefined) {
|
|
3984
3985
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -4238,6 +4239,9 @@ function imageConfigToMldev$1(fromObject) {
|
|
|
4238
4239
|
if (fromImageSize != null) {
|
|
4239
4240
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
4240
4241
|
}
|
|
4242
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
4243
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
4244
|
+
}
|
|
4241
4245
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
4242
4246
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
4243
4247
|
}
|
|
@@ -4463,43 +4467,25 @@ function safetySettingToMldev$1(fromObject) {
|
|
|
4463
4467
|
}
|
|
4464
4468
|
function toolConfigToMldev$2(fromObject) {
|
|
4465
4469
|
const toObject = {};
|
|
4466
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4467
|
-
'functionCallingConfig',
|
|
4468
|
-
]);
|
|
4469
|
-
if (fromFunctionCallingConfig != null) {
|
|
4470
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4471
|
-
}
|
|
4472
4470
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
4473
4471
|
'retrievalConfig',
|
|
4474
4472
|
]);
|
|
4475
4473
|
if (fromRetrievalConfig != null) {
|
|
4476
4474
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
4477
4475
|
}
|
|
4476
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
4477
|
+
'functionCallingConfig',
|
|
4478
|
+
]);
|
|
4479
|
+
if (fromFunctionCallingConfig != null) {
|
|
4480
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$2(fromFunctionCallingConfig));
|
|
4481
|
+
}
|
|
4478
4482
|
return toObject;
|
|
4479
4483
|
}
|
|
4480
4484
|
function toolToMldev$4(fromObject) {
|
|
4481
4485
|
const toObject = {};
|
|
4482
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4483
|
-
'functionDeclarations',
|
|
4484
|
-
]);
|
|
4485
|
-
if (fromFunctionDeclarations != null) {
|
|
4486
|
-
let transformedList = fromFunctionDeclarations;
|
|
4487
|
-
if (Array.isArray(transformedList)) {
|
|
4488
|
-
transformedList = transformedList.map((item) => {
|
|
4489
|
-
return item;
|
|
4490
|
-
});
|
|
4491
|
-
}
|
|
4492
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4493
|
-
}
|
|
4494
4486
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
4495
4487
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
4496
4488
|
}
|
|
4497
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4498
|
-
'googleSearchRetrieval',
|
|
4499
|
-
]);
|
|
4500
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
4501
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4502
|
-
}
|
|
4503
4489
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
4504
4490
|
if (fromComputerUse != null) {
|
|
4505
4491
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -4517,6 +4503,18 @@ function toolToMldev$4(fromObject) {
|
|
|
4517
4503
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4518
4504
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4519
4505
|
}
|
|
4506
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
4507
|
+
'functionDeclarations',
|
|
4508
|
+
]);
|
|
4509
|
+
if (fromFunctionDeclarations != null) {
|
|
4510
|
+
let transformedList = fromFunctionDeclarations;
|
|
4511
|
+
if (Array.isArray(transformedList)) {
|
|
4512
|
+
transformedList = transformedList.map((item) => {
|
|
4513
|
+
return item;
|
|
4514
|
+
});
|
|
4515
|
+
}
|
|
4516
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
4517
|
+
}
|
|
4520
4518
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4521
4519
|
if (fromGoogleMaps != null) {
|
|
4522
4520
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
@@ -4525,6 +4523,12 @@ function toolToMldev$4(fromObject) {
|
|
|
4525
4523
|
if (fromGoogleSearch != null) {
|
|
4526
4524
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$4(fromGoogleSearch));
|
|
4527
4525
|
}
|
|
4526
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
4527
|
+
'googleSearchRetrieval',
|
|
4528
|
+
]);
|
|
4529
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
4530
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
4531
|
+
}
|
|
4528
4532
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4529
4533
|
if (fromUrlContext != null) {
|
|
4530
4534
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5455,16 +5459,16 @@ function functionCallToMldev$3(fromObject) {
|
|
|
5455
5459
|
}
|
|
5456
5460
|
function functionCallingConfigToMldev$1(fromObject) {
|
|
5457
5461
|
const toObject = {};
|
|
5458
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5459
|
-
if (fromMode != null) {
|
|
5460
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
5461
|
-
}
|
|
5462
5462
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
5463
5463
|
'allowedFunctionNames',
|
|
5464
5464
|
]);
|
|
5465
5465
|
if (fromAllowedFunctionNames != null) {
|
|
5466
5466
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
5467
5467
|
}
|
|
5468
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
5469
|
+
if (fromMode != null) {
|
|
5470
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
5471
|
+
}
|
|
5468
5472
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
5469
5473
|
undefined) {
|
|
5470
5474
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -5473,9 +5477,6 @@ function functionCallingConfigToMldev$1(fromObject) {
|
|
|
5473
5477
|
}
|
|
5474
5478
|
function functionDeclarationToVertex$2(fromObject) {
|
|
5475
5479
|
const toObject = {};
|
|
5476
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5477
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5478
|
-
}
|
|
5479
5480
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
5480
5481
|
if (fromDescription != null) {
|
|
5481
5482
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -5504,6 +5505,9 @@ function functionDeclarationToVertex$2(fromObject) {
|
|
|
5504
5505
|
if (fromResponseJsonSchema != null) {
|
|
5505
5506
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
5506
5507
|
}
|
|
5508
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
5509
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
5510
|
+
}
|
|
5507
5511
|
return toObject;
|
|
5508
5512
|
}
|
|
5509
5513
|
function getCachedContentParametersToMldev(apiClient, fromObject) {
|
|
@@ -5707,43 +5711,25 @@ function partToMldev$3(fromObject) {
|
|
|
5707
5711
|
}
|
|
5708
5712
|
function toolConfigToMldev$1(fromObject) {
|
|
5709
5713
|
const toObject = {};
|
|
5710
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5711
|
-
'functionCallingConfig',
|
|
5712
|
-
]);
|
|
5713
|
-
if (fromFunctionCallingConfig != null) {
|
|
5714
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5715
|
-
}
|
|
5716
5714
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
5717
5715
|
'retrievalConfig',
|
|
5718
5716
|
]);
|
|
5719
5717
|
if (fromRetrievalConfig != null) {
|
|
5720
5718
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
5721
5719
|
}
|
|
5720
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
5721
|
+
'functionCallingConfig',
|
|
5722
|
+
]);
|
|
5723
|
+
if (fromFunctionCallingConfig != null) {
|
|
5724
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev$1(fromFunctionCallingConfig));
|
|
5725
|
+
}
|
|
5722
5726
|
return toObject;
|
|
5723
5727
|
}
|
|
5724
5728
|
function toolToMldev$3(fromObject) {
|
|
5725
5729
|
const toObject = {};
|
|
5726
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5727
|
-
'functionDeclarations',
|
|
5728
|
-
]);
|
|
5729
|
-
if (fromFunctionDeclarations != null) {
|
|
5730
|
-
let transformedList = fromFunctionDeclarations;
|
|
5731
|
-
if (Array.isArray(transformedList)) {
|
|
5732
|
-
transformedList = transformedList.map((item) => {
|
|
5733
|
-
return item;
|
|
5734
|
-
});
|
|
5735
|
-
}
|
|
5736
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5737
|
-
}
|
|
5738
5730
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
5739
5731
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
5740
5732
|
}
|
|
5741
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5742
|
-
'googleSearchRetrieval',
|
|
5743
|
-
]);
|
|
5744
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5745
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5746
|
-
}
|
|
5747
5733
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5748
5734
|
if (fromComputerUse != null) {
|
|
5749
5735
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5761,6 +5747,18 @@ function toolToMldev$3(fromObject) {
|
|
|
5761
5747
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5762
5748
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5763
5749
|
}
|
|
5750
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5751
|
+
'functionDeclarations',
|
|
5752
|
+
]);
|
|
5753
|
+
if (fromFunctionDeclarations != null) {
|
|
5754
|
+
let transformedList = fromFunctionDeclarations;
|
|
5755
|
+
if (Array.isArray(transformedList)) {
|
|
5756
|
+
transformedList = transformedList.map((item) => {
|
|
5757
|
+
return item;
|
|
5758
|
+
});
|
|
5759
|
+
}
|
|
5760
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5761
|
+
}
|
|
5764
5762
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5765
5763
|
if (fromGoogleMaps != null) {
|
|
5766
5764
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
@@ -5769,6 +5767,12 @@ function toolToMldev$3(fromObject) {
|
|
|
5769
5767
|
if (fromGoogleSearch != null) {
|
|
5770
5768
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$3(fromGoogleSearch));
|
|
5771
5769
|
}
|
|
5770
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5771
|
+
'googleSearchRetrieval',
|
|
5772
|
+
]);
|
|
5773
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5774
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5775
|
+
}
|
|
5772
5776
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5773
5777
|
if (fromUrlContext != null) {
|
|
5774
5778
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -5777,28 +5781,10 @@ function toolToMldev$3(fromObject) {
|
|
|
5777
5781
|
}
|
|
5778
5782
|
function toolToVertex$2(fromObject) {
|
|
5779
5783
|
const toObject = {};
|
|
5780
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5781
|
-
'functionDeclarations',
|
|
5782
|
-
]);
|
|
5783
|
-
if (fromFunctionDeclarations != null) {
|
|
5784
|
-
let transformedList = fromFunctionDeclarations;
|
|
5785
|
-
if (Array.isArray(transformedList)) {
|
|
5786
|
-
transformedList = transformedList.map((item) => {
|
|
5787
|
-
return functionDeclarationToVertex$2(item);
|
|
5788
|
-
});
|
|
5789
|
-
}
|
|
5790
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5791
|
-
}
|
|
5792
5784
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
5793
5785
|
if (fromRetrieval != null) {
|
|
5794
5786
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
5795
5787
|
}
|
|
5796
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5797
|
-
'googleSearchRetrieval',
|
|
5798
|
-
]);
|
|
5799
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
5800
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5801
|
-
}
|
|
5802
5788
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
5803
5789
|
if (fromComputerUse != null) {
|
|
5804
5790
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -5818,6 +5804,18 @@ function toolToVertex$2(fromObject) {
|
|
|
5818
5804
|
if (fromEnterpriseWebSearch != null) {
|
|
5819
5805
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
5820
5806
|
}
|
|
5807
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
5808
|
+
'functionDeclarations',
|
|
5809
|
+
]);
|
|
5810
|
+
if (fromFunctionDeclarations != null) {
|
|
5811
|
+
let transformedList = fromFunctionDeclarations;
|
|
5812
|
+
if (Array.isArray(transformedList)) {
|
|
5813
|
+
transformedList = transformedList.map((item) => {
|
|
5814
|
+
return functionDeclarationToVertex$2(item);
|
|
5815
|
+
});
|
|
5816
|
+
}
|
|
5817
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
5818
|
+
}
|
|
5821
5819
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5822
5820
|
if (fromGoogleMaps != null) {
|
|
5823
5821
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -5826,6 +5824,12 @@ function toolToVertex$2(fromObject) {
|
|
|
5826
5824
|
if (fromGoogleSearch != null) {
|
|
5827
5825
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
5828
5826
|
}
|
|
5827
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
5828
|
+
'googleSearchRetrieval',
|
|
5829
|
+
]);
|
|
5830
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
5831
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
5832
|
+
}
|
|
5829
5833
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5830
5834
|
if (fromUrlContext != null) {
|
|
5831
5835
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -7117,9 +7121,6 @@ function functionCallToMldev$2(fromObject) {
|
|
|
7117
7121
|
}
|
|
7118
7122
|
function functionDeclarationToVertex$1(fromObject) {
|
|
7119
7123
|
const toObject = {};
|
|
7120
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
7121
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
7122
|
-
}
|
|
7123
7124
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
7124
7125
|
if (fromDescription != null) {
|
|
7125
7126
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -7148,6 +7149,9 @@ function functionDeclarationToVertex$1(fromObject) {
|
|
|
7148
7149
|
if (fromResponseJsonSchema != null) {
|
|
7149
7150
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
7150
7151
|
}
|
|
7152
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
7153
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
7154
|
+
}
|
|
7151
7155
|
return toObject;
|
|
7152
7156
|
}
|
|
7153
7157
|
function generationConfigToVertex$1(fromObject) {
|
|
@@ -7246,7 +7250,7 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
7246
7250
|
}
|
|
7247
7251
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7248
7252
|
if (fromSpeechConfig != null) {
|
|
7249
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
7253
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
7250
7254
|
}
|
|
7251
7255
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
7252
7256
|
'stopSequences',
|
|
@@ -7462,7 +7466,7 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
7462
7466
|
}
|
|
7463
7467
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
7464
7468
|
if (parentObject !== undefined && fromSpeechConfig != null) {
|
|
7465
|
-
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'],
|
|
7469
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'speechConfig'], tLiveSpeechConfig(fromSpeechConfig));
|
|
7466
7470
|
}
|
|
7467
7471
|
const fromThinkingConfig = getValueByPath(fromObject, [
|
|
7468
7472
|
'thinkingConfig',
|
|
@@ -7787,44 +7791,11 @@ function sessionResumptionConfigToMldev$1(fromObject) {
|
|
|
7787
7791
|
}
|
|
7788
7792
|
return toObject;
|
|
7789
7793
|
}
|
|
7790
|
-
function speechConfigToVertex$1(fromObject) {
|
|
7791
|
-
const toObject = {};
|
|
7792
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
7793
|
-
if (fromVoiceConfig != null) {
|
|
7794
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
7795
|
-
}
|
|
7796
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
7797
|
-
if (fromLanguageCode != null) {
|
|
7798
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
7799
|
-
}
|
|
7800
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
7801
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
7802
|
-
}
|
|
7803
|
-
return toObject;
|
|
7804
|
-
}
|
|
7805
7794
|
function toolToMldev$2(fromObject) {
|
|
7806
7795
|
const toObject = {};
|
|
7807
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7808
|
-
'functionDeclarations',
|
|
7809
|
-
]);
|
|
7810
|
-
if (fromFunctionDeclarations != null) {
|
|
7811
|
-
let transformedList = fromFunctionDeclarations;
|
|
7812
|
-
if (Array.isArray(transformedList)) {
|
|
7813
|
-
transformedList = transformedList.map((item) => {
|
|
7814
|
-
return item;
|
|
7815
|
-
});
|
|
7816
|
-
}
|
|
7817
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7818
|
-
}
|
|
7819
7796
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
7820
7797
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
7821
7798
|
}
|
|
7822
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7823
|
-
'googleSearchRetrieval',
|
|
7824
|
-
]);
|
|
7825
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
7826
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7827
|
-
}
|
|
7828
7799
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7829
7800
|
if (fromComputerUse != null) {
|
|
7830
7801
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -7842,6 +7813,18 @@ function toolToMldev$2(fromObject) {
|
|
|
7842
7813
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7843
7814
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
7844
7815
|
}
|
|
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
|
+
}
|
|
7845
7828
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
7846
7829
|
if (fromGoogleMaps != null) {
|
|
7847
7830
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
@@ -7850,6 +7833,12 @@ function toolToMldev$2(fromObject) {
|
|
|
7850
7833
|
if (fromGoogleSearch != null) {
|
|
7851
7834
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$2(fromGoogleSearch));
|
|
7852
7835
|
}
|
|
7836
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7837
|
+
'googleSearchRetrieval',
|
|
7838
|
+
]);
|
|
7839
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
7840
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7841
|
+
}
|
|
7853
7842
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7854
7843
|
if (fromUrlContext != null) {
|
|
7855
7844
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -7858,28 +7847,10 @@ function toolToMldev$2(fromObject) {
|
|
|
7858
7847
|
}
|
|
7859
7848
|
function toolToVertex$1(fromObject) {
|
|
7860
7849
|
const toObject = {};
|
|
7861
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7862
|
-
'functionDeclarations',
|
|
7863
|
-
]);
|
|
7864
|
-
if (fromFunctionDeclarations != null) {
|
|
7865
|
-
let transformedList = fromFunctionDeclarations;
|
|
7866
|
-
if (Array.isArray(transformedList)) {
|
|
7867
|
-
transformedList = transformedList.map((item) => {
|
|
7868
|
-
return functionDeclarationToVertex$1(item);
|
|
7869
|
-
});
|
|
7870
|
-
}
|
|
7871
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7872
|
-
}
|
|
7873
7850
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
7874
7851
|
if (fromRetrieval != null) {
|
|
7875
7852
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
7876
7853
|
}
|
|
7877
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7878
|
-
'googleSearchRetrieval',
|
|
7879
|
-
]);
|
|
7880
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
7881
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7882
|
-
}
|
|
7883
7854
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
7884
7855
|
if (fromComputerUse != null) {
|
|
7885
7856
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -7899,6 +7870,18 @@ function toolToVertex$1(fromObject) {
|
|
|
7899
7870
|
if (fromEnterpriseWebSearch != null) {
|
|
7900
7871
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
7901
7872
|
}
|
|
7873
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
7874
|
+
'functionDeclarations',
|
|
7875
|
+
]);
|
|
7876
|
+
if (fromFunctionDeclarations != null) {
|
|
7877
|
+
let transformedList = fromFunctionDeclarations;
|
|
7878
|
+
if (Array.isArray(transformedList)) {
|
|
7879
|
+
transformedList = transformedList.map((item) => {
|
|
7880
|
+
return functionDeclarationToVertex$1(item);
|
|
7881
|
+
});
|
|
7882
|
+
}
|
|
7883
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
7884
|
+
}
|
|
7902
7885
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
7903
7886
|
if (fromGoogleMaps != null) {
|
|
7904
7887
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -7907,6 +7890,12 @@ function toolToVertex$1(fromObject) {
|
|
|
7907
7890
|
if (fromGoogleSearch != null) {
|
|
7908
7891
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
7909
7892
|
}
|
|
7893
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
7894
|
+
'googleSearchRetrieval',
|
|
7895
|
+
]);
|
|
7896
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
7897
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
7898
|
+
}
|
|
7910
7899
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7911
7900
|
if (fromUrlContext != null) {
|
|
7912
7901
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -8689,16 +8678,16 @@ function functionCallToMldev$1(fromObject) {
|
|
|
8689
8678
|
}
|
|
8690
8679
|
function functionCallingConfigToMldev(fromObject) {
|
|
8691
8680
|
const toObject = {};
|
|
8692
|
-
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8693
|
-
if (fromMode != null) {
|
|
8694
|
-
setValueByPath(toObject, ['mode'], fromMode);
|
|
8695
|
-
}
|
|
8696
8681
|
const fromAllowedFunctionNames = getValueByPath(fromObject, [
|
|
8697
8682
|
'allowedFunctionNames',
|
|
8698
8683
|
]);
|
|
8699
8684
|
if (fromAllowedFunctionNames != null) {
|
|
8700
8685
|
setValueByPath(toObject, ['allowedFunctionNames'], fromAllowedFunctionNames);
|
|
8701
8686
|
}
|
|
8687
|
+
const fromMode = getValueByPath(fromObject, ['mode']);
|
|
8688
|
+
if (fromMode != null) {
|
|
8689
|
+
setValueByPath(toObject, ['mode'], fromMode);
|
|
8690
|
+
}
|
|
8702
8691
|
if (getValueByPath(fromObject, ['streamFunctionCallArguments']) !==
|
|
8703
8692
|
undefined) {
|
|
8704
8693
|
throw new Error('streamFunctionCallArguments parameter is not supported in Gemini API.');
|
|
@@ -8707,9 +8696,6 @@ function functionCallingConfigToMldev(fromObject) {
|
|
|
8707
8696
|
}
|
|
8708
8697
|
function functionDeclarationToVertex(fromObject) {
|
|
8709
8698
|
const toObject = {};
|
|
8710
|
-
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
8711
|
-
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
8712
|
-
}
|
|
8713
8699
|
const fromDescription = getValueByPath(fromObject, ['description']);
|
|
8714
8700
|
if (fromDescription != null) {
|
|
8715
8701
|
setValueByPath(toObject, ['description'], fromDescription);
|
|
@@ -8738,6 +8724,9 @@ function functionDeclarationToVertex(fromObject) {
|
|
|
8738
8724
|
if (fromResponseJsonSchema != null) {
|
|
8739
8725
|
setValueByPath(toObject, ['responseJsonSchema'], fromResponseJsonSchema);
|
|
8740
8726
|
}
|
|
8727
|
+
if (getValueByPath(fromObject, ['behavior']) !== undefined) {
|
|
8728
|
+
throw new Error('behavior parameter is not supported in Vertex AI.');
|
|
8729
|
+
}
|
|
8741
8730
|
return toObject;
|
|
8742
8731
|
}
|
|
8743
8732
|
function generateContentConfigToMldev(apiClient, fromObject, parentObject) {
|
|
@@ -9044,7 +9033,7 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9044
9033
|
}
|
|
9045
9034
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
9046
9035
|
if (fromSpeechConfig != null) {
|
|
9047
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
9036
|
+
setValueByPath(toObject, ['speechConfig'], tSpeechConfig(fromSpeechConfig));
|
|
9048
9037
|
}
|
|
9049
9038
|
const fromAudioTimestamp = getValueByPath(fromObject, [
|
|
9050
9039
|
'audioTimestamp',
|
|
@@ -9990,7 +9979,7 @@ function generationConfigToVertex(fromObject) {
|
|
|
9990
9979
|
}
|
|
9991
9980
|
const fromSpeechConfig = getValueByPath(fromObject, ['speechConfig']);
|
|
9992
9981
|
if (fromSpeechConfig != null) {
|
|
9993
|
-
setValueByPath(toObject, ['speechConfig'],
|
|
9982
|
+
setValueByPath(toObject, ['speechConfig'], fromSpeechConfig);
|
|
9994
9983
|
}
|
|
9995
9984
|
const fromStopSequences = getValueByPath(fromObject, [
|
|
9996
9985
|
'stopSequences',
|
|
@@ -10075,6 +10064,9 @@ function imageConfigToMldev(fromObject) {
|
|
|
10075
10064
|
if (fromImageSize != null) {
|
|
10076
10065
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
10077
10066
|
}
|
|
10067
|
+
if (getValueByPath(fromObject, ['personGeneration']) !== undefined) {
|
|
10068
|
+
throw new Error('personGeneration parameter is not supported in Gemini API.');
|
|
10069
|
+
}
|
|
10078
10070
|
if (getValueByPath(fromObject, ['outputMimeType']) !== undefined) {
|
|
10079
10071
|
throw new Error('outputMimeType parameter is not supported in Gemini API.');
|
|
10080
10072
|
}
|
|
@@ -10094,6 +10086,12 @@ function imageConfigToVertex(fromObject) {
|
|
|
10094
10086
|
if (fromImageSize != null) {
|
|
10095
10087
|
setValueByPath(toObject, ['imageSize'], fromImageSize);
|
|
10096
10088
|
}
|
|
10089
|
+
const fromPersonGeneration = getValueByPath(fromObject, [
|
|
10090
|
+
'personGeneration',
|
|
10091
|
+
]);
|
|
10092
|
+
if (fromPersonGeneration != null) {
|
|
10093
|
+
setValueByPath(toObject, ['personGeneration'], fromPersonGeneration);
|
|
10094
|
+
}
|
|
10097
10095
|
const fromOutputMimeType = getValueByPath(fromObject, [
|
|
10098
10096
|
'outputMimeType',
|
|
10099
10097
|
]);
|
|
@@ -10792,60 +10790,27 @@ function segmentImageSourceToVertex(fromObject, parentObject) {
|
|
|
10792
10790
|
}
|
|
10793
10791
|
return toObject;
|
|
10794
10792
|
}
|
|
10795
|
-
function speechConfigToVertex(fromObject) {
|
|
10796
|
-
const toObject = {};
|
|
10797
|
-
const fromVoiceConfig = getValueByPath(fromObject, ['voiceConfig']);
|
|
10798
|
-
if (fromVoiceConfig != null) {
|
|
10799
|
-
setValueByPath(toObject, ['voiceConfig'], fromVoiceConfig);
|
|
10800
|
-
}
|
|
10801
|
-
const fromLanguageCode = getValueByPath(fromObject, ['languageCode']);
|
|
10802
|
-
if (fromLanguageCode != null) {
|
|
10803
|
-
setValueByPath(toObject, ['languageCode'], fromLanguageCode);
|
|
10804
|
-
}
|
|
10805
|
-
if (getValueByPath(fromObject, ['multiSpeakerVoiceConfig']) !== undefined) {
|
|
10806
|
-
throw new Error('multiSpeakerVoiceConfig parameter is not supported in Vertex AI.');
|
|
10807
|
-
}
|
|
10808
|
-
return toObject;
|
|
10809
|
-
}
|
|
10810
10793
|
function toolConfigToMldev(fromObject) {
|
|
10811
10794
|
const toObject = {};
|
|
10812
|
-
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
10813
|
-
'functionCallingConfig',
|
|
10814
|
-
]);
|
|
10815
|
-
if (fromFunctionCallingConfig != null) {
|
|
10816
|
-
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
10817
|
-
}
|
|
10818
10795
|
const fromRetrievalConfig = getValueByPath(fromObject, [
|
|
10819
10796
|
'retrievalConfig',
|
|
10820
10797
|
]);
|
|
10821
10798
|
if (fromRetrievalConfig != null) {
|
|
10822
10799
|
setValueByPath(toObject, ['retrievalConfig'], fromRetrievalConfig);
|
|
10823
10800
|
}
|
|
10801
|
+
const fromFunctionCallingConfig = getValueByPath(fromObject, [
|
|
10802
|
+
'functionCallingConfig',
|
|
10803
|
+
]);
|
|
10804
|
+
if (fromFunctionCallingConfig != null) {
|
|
10805
|
+
setValueByPath(toObject, ['functionCallingConfig'], functionCallingConfigToMldev(fromFunctionCallingConfig));
|
|
10806
|
+
}
|
|
10824
10807
|
return toObject;
|
|
10825
10808
|
}
|
|
10826
10809
|
function toolToMldev$1(fromObject) {
|
|
10827
10810
|
const toObject = {};
|
|
10828
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10829
|
-
'functionDeclarations',
|
|
10830
|
-
]);
|
|
10831
|
-
if (fromFunctionDeclarations != null) {
|
|
10832
|
-
let transformedList = fromFunctionDeclarations;
|
|
10833
|
-
if (Array.isArray(transformedList)) {
|
|
10834
|
-
transformedList = transformedList.map((item) => {
|
|
10835
|
-
return item;
|
|
10836
|
-
});
|
|
10837
|
-
}
|
|
10838
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10839
|
-
}
|
|
10840
10811
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
10841
10812
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
10842
10813
|
}
|
|
10843
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10844
|
-
'googleSearchRetrieval',
|
|
10845
|
-
]);
|
|
10846
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
10847
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10848
|
-
}
|
|
10849
10814
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10850
10815
|
if (fromComputerUse != null) {
|
|
10851
10816
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -10863,6 +10828,18 @@ function toolToMldev$1(fromObject) {
|
|
|
10863
10828
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
10864
10829
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
10865
10830
|
}
|
|
10831
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10832
|
+
'functionDeclarations',
|
|
10833
|
+
]);
|
|
10834
|
+
if (fromFunctionDeclarations != null) {
|
|
10835
|
+
let transformedList = fromFunctionDeclarations;
|
|
10836
|
+
if (Array.isArray(transformedList)) {
|
|
10837
|
+
transformedList = transformedList.map((item) => {
|
|
10838
|
+
return item;
|
|
10839
|
+
});
|
|
10840
|
+
}
|
|
10841
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10842
|
+
}
|
|
10866
10843
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10867
10844
|
if (fromGoogleMaps != null) {
|
|
10868
10845
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
@@ -10871,6 +10848,12 @@ function toolToMldev$1(fromObject) {
|
|
|
10871
10848
|
if (fromGoogleSearch != null) {
|
|
10872
10849
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev$1(fromGoogleSearch));
|
|
10873
10850
|
}
|
|
10851
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10852
|
+
'googleSearchRetrieval',
|
|
10853
|
+
]);
|
|
10854
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
10855
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10856
|
+
}
|
|
10874
10857
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10875
10858
|
if (fromUrlContext != null) {
|
|
10876
10859
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -10879,28 +10862,10 @@ function toolToMldev$1(fromObject) {
|
|
|
10879
10862
|
}
|
|
10880
10863
|
function toolToVertex(fromObject) {
|
|
10881
10864
|
const toObject = {};
|
|
10882
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10883
|
-
'functionDeclarations',
|
|
10884
|
-
]);
|
|
10885
|
-
if (fromFunctionDeclarations != null) {
|
|
10886
|
-
let transformedList = fromFunctionDeclarations;
|
|
10887
|
-
if (Array.isArray(transformedList)) {
|
|
10888
|
-
transformedList = transformedList.map((item) => {
|
|
10889
|
-
return functionDeclarationToVertex(item);
|
|
10890
|
-
});
|
|
10891
|
-
}
|
|
10892
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10893
|
-
}
|
|
10894
10865
|
const fromRetrieval = getValueByPath(fromObject, ['retrieval']);
|
|
10895
10866
|
if (fromRetrieval != null) {
|
|
10896
10867
|
setValueByPath(toObject, ['retrieval'], fromRetrieval);
|
|
10897
10868
|
}
|
|
10898
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10899
|
-
'googleSearchRetrieval',
|
|
10900
|
-
]);
|
|
10901
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
10902
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10903
|
-
}
|
|
10904
10869
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
10905
10870
|
if (fromComputerUse != null) {
|
|
10906
10871
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -10920,6 +10885,18 @@ function toolToVertex(fromObject) {
|
|
|
10920
10885
|
if (fromEnterpriseWebSearch != null) {
|
|
10921
10886
|
setValueByPath(toObject, ['enterpriseWebSearch'], fromEnterpriseWebSearch);
|
|
10922
10887
|
}
|
|
10888
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
10889
|
+
'functionDeclarations',
|
|
10890
|
+
]);
|
|
10891
|
+
if (fromFunctionDeclarations != null) {
|
|
10892
|
+
let transformedList = fromFunctionDeclarations;
|
|
10893
|
+
if (Array.isArray(transformedList)) {
|
|
10894
|
+
transformedList = transformedList.map((item) => {
|
|
10895
|
+
return functionDeclarationToVertex(item);
|
|
10896
|
+
});
|
|
10897
|
+
}
|
|
10898
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
10899
|
+
}
|
|
10923
10900
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10924
10901
|
if (fromGoogleMaps != null) {
|
|
10925
10902
|
setValueByPath(toObject, ['googleMaps'], fromGoogleMaps);
|
|
@@ -10928,6 +10905,12 @@ function toolToVertex(fromObject) {
|
|
|
10928
10905
|
if (fromGoogleSearch != null) {
|
|
10929
10906
|
setValueByPath(toObject, ['googleSearch'], fromGoogleSearch);
|
|
10930
10907
|
}
|
|
10908
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
10909
|
+
'googleSearchRetrieval',
|
|
10910
|
+
]);
|
|
10911
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
10912
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
10913
|
+
}
|
|
10931
10914
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10932
10915
|
if (fromUrlContext != null) {
|
|
10933
10916
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -11488,7 +11471,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
11488
11471
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
11489
11472
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
11490
11473
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
11491
|
-
const SDK_VERSION = '1.
|
|
11474
|
+
const SDK_VERSION = '1.35.0'; // x-release-please-version
|
|
11492
11475
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
11493
11476
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
11494
11477
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11562,6 +11545,11 @@ class ApiClient {
|
|
|
11562
11545
|
getLocation() {
|
|
11563
11546
|
return this.clientOptions.location;
|
|
11564
11547
|
}
|
|
11548
|
+
async getAuthHeaders() {
|
|
11549
|
+
const headers = new Headers();
|
|
11550
|
+
await this.clientOptions.auth.addAuthHeaders(headers);
|
|
11551
|
+
return headers;
|
|
11552
|
+
}
|
|
11565
11553
|
getApiVersion() {
|
|
11566
11554
|
if (this.clientOptions.httpOptions &&
|
|
11567
11555
|
this.clientOptions.httpOptions.apiVersion !== undefined) {
|
|
@@ -13197,7 +13185,7 @@ class Models extends BaseModule {
|
|
|
13197
13185
|
* @example
|
|
13198
13186
|
* ```ts
|
|
13199
13187
|
* const response = await client.models.generateImages({
|
|
13200
|
-
* model: 'imagen-
|
|
13188
|
+
* model: 'imagen-4.0-generate-001',
|
|
13201
13189
|
* prompt: 'Robot holding a red skateboard',
|
|
13202
13190
|
* config: {
|
|
13203
13191
|
* numberOfImages: 1,
|
|
@@ -13306,7 +13294,7 @@ class Models extends BaseModule {
|
|
|
13306
13294
|
* @example
|
|
13307
13295
|
* ```ts
|
|
13308
13296
|
* const response = await client.models.upscaleImage({
|
|
13309
|
-
* model: 'imagen-
|
|
13297
|
+
* model: 'imagen-4.0-upscale-preview',
|
|
13310
13298
|
* image: image,
|
|
13311
13299
|
* upscaleFactor: 'x2',
|
|
13312
13300
|
* config: {
|
|
@@ -13968,7 +13956,7 @@ class Models extends BaseModule {
|
|
|
13968
13956
|
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
13969
13957
|
*
|
|
13970
13958
|
* const response2 = await ai.models.recontextImage({
|
|
13971
|
-
* model: 'virtual-try-on-
|
|
13959
|
+
* model: 'virtual-try-on-001',
|
|
13972
13960
|
* source: {
|
|
13973
13961
|
* personImage: personImage,
|
|
13974
13962
|
* productImages: [productImage],
|
|
@@ -15050,27 +15038,9 @@ function sessionResumptionConfigToMldev(fromObject) {
|
|
|
15050
15038
|
}
|
|
15051
15039
|
function toolToMldev(fromObject) {
|
|
15052
15040
|
const toObject = {};
|
|
15053
|
-
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
15054
|
-
'functionDeclarations',
|
|
15055
|
-
]);
|
|
15056
|
-
if (fromFunctionDeclarations != null) {
|
|
15057
|
-
let transformedList = fromFunctionDeclarations;
|
|
15058
|
-
if (Array.isArray(transformedList)) {
|
|
15059
|
-
transformedList = transformedList.map((item) => {
|
|
15060
|
-
return item;
|
|
15061
|
-
});
|
|
15062
|
-
}
|
|
15063
|
-
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
15064
|
-
}
|
|
15065
15041
|
if (getValueByPath(fromObject, ['retrieval']) !== undefined) {
|
|
15066
15042
|
throw new Error('retrieval parameter is not supported in Gemini API.');
|
|
15067
15043
|
}
|
|
15068
|
-
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
15069
|
-
'googleSearchRetrieval',
|
|
15070
|
-
]);
|
|
15071
|
-
if (fromGoogleSearchRetrieval != null) {
|
|
15072
|
-
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
15073
|
-
}
|
|
15074
15044
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
15075
15045
|
if (fromComputerUse != null) {
|
|
15076
15046
|
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
@@ -15088,6 +15058,18 @@ function toolToMldev(fromObject) {
|
|
|
15088
15058
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
15089
15059
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
15090
15060
|
}
|
|
15061
|
+
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
15062
|
+
'functionDeclarations',
|
|
15063
|
+
]);
|
|
15064
|
+
if (fromFunctionDeclarations != null) {
|
|
15065
|
+
let transformedList = fromFunctionDeclarations;
|
|
15066
|
+
if (Array.isArray(transformedList)) {
|
|
15067
|
+
transformedList = transformedList.map((item) => {
|
|
15068
|
+
return item;
|
|
15069
|
+
});
|
|
15070
|
+
}
|
|
15071
|
+
setValueByPath(toObject, ['functionDeclarations'], transformedList);
|
|
15072
|
+
}
|
|
15091
15073
|
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
15092
15074
|
if (fromGoogleMaps != null) {
|
|
15093
15075
|
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
@@ -15096,6 +15078,12 @@ function toolToMldev(fromObject) {
|
|
|
15096
15078
|
if (fromGoogleSearch != null) {
|
|
15097
15079
|
setValueByPath(toObject, ['googleSearch'], googleSearchToMldev(fromGoogleSearch));
|
|
15098
15080
|
}
|
|
15081
|
+
const fromGoogleSearchRetrieval = getValueByPath(fromObject, [
|
|
15082
|
+
'googleSearchRetrieval',
|
|
15083
|
+
]);
|
|
15084
|
+
if (fromGoogleSearchRetrieval != null) {
|
|
15085
|
+
setValueByPath(toObject, ['googleSearchRetrieval'], fromGoogleSearchRetrieval);
|
|
15086
|
+
}
|
|
15099
15087
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
15100
15088
|
if (fromUrlContext != null) {
|
|
15101
15089
|
setValueByPath(toObject, ['urlContext'], fromUrlContext);
|
|
@@ -17434,7 +17422,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17434
17422
|
*/
|
|
17435
17423
|
constructor(_b) {
|
|
17436
17424
|
var _c, _d, _e, _f, _g, _h, _j;
|
|
17437
|
-
var
|
|
17425
|
+
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"]);
|
|
17438
17426
|
const options = Object.assign(Object.assign({ apiKey,
|
|
17439
17427
|
apiVersion }, opts), { baseURL: baseURL || `https://generativelanguage.googleapis.com` });
|
|
17440
17428
|
this.baseURL = options.baseURL;
|
|
@@ -17452,6 +17440,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17452
17440
|
this._options = options;
|
|
17453
17441
|
this.apiKey = apiKey;
|
|
17454
17442
|
this.apiVersion = apiVersion;
|
|
17443
|
+
this.clientAdapter = options.clientAdapter;
|
|
17455
17444
|
}
|
|
17456
17445
|
/**
|
|
17457
17446
|
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
@@ -17470,6 +17459,10 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17470
17459
|
return this._options.defaultQuery;
|
|
17471
17460
|
}
|
|
17472
17461
|
validateHeaders({ values, nulls }) {
|
|
17462
|
+
// The headers object handles case insensitivity.
|
|
17463
|
+
if (values.has('authorization') || values.has('x-goog-api-key')) {
|
|
17464
|
+
return;
|
|
17465
|
+
}
|
|
17473
17466
|
if (this.apiKey && values.get('x-goog-api-key')) {
|
|
17474
17467
|
return;
|
|
17475
17468
|
}
|
|
@@ -17479,10 +17472,17 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17479
17472
|
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');
|
|
17480
17473
|
}
|
|
17481
17474
|
async authHeaders(opts) {
|
|
17482
|
-
|
|
17475
|
+
const existingHeaders = buildHeaders([opts.headers]);
|
|
17476
|
+
if (existingHeaders.values.has('authorization') || existingHeaders.values.has('x-goog-api-key')) {
|
|
17483
17477
|
return undefined;
|
|
17484
17478
|
}
|
|
17485
|
-
|
|
17479
|
+
if (this.apiKey) {
|
|
17480
|
+
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
17481
|
+
}
|
|
17482
|
+
if (this.clientAdapter.isVertexAI()) {
|
|
17483
|
+
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
17484
|
+
}
|
|
17485
|
+
return undefined;
|
|
17486
17486
|
}
|
|
17487
17487
|
/**
|
|
17488
17488
|
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
@@ -17526,8 +17526,16 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17526
17526
|
}
|
|
17527
17527
|
/**
|
|
17528
17528
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
17529
|
+
|
|
17529
17530
|
*/
|
|
17530
|
-
async prepareOptions(options) {
|
|
17531
|
+
async prepareOptions(options) {
|
|
17532
|
+
if (this.clientAdapter &&
|
|
17533
|
+
this.clientAdapter.isVertexAI() &&
|
|
17534
|
+
!options.path.startsWith(`/${this.apiVersion}/projects/`)) {
|
|
17535
|
+
const oldPath = options.path.slice(this.apiVersion.length + 1);
|
|
17536
|
+
options.path = `/${this.apiVersion}/projects/${this.clientAdapter.getProject()}/locations/${this.clientAdapter.getLocation()}${oldPath}`;
|
|
17537
|
+
}
|
|
17538
|
+
}
|
|
17531
17539
|
/**
|
|
17532
17540
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
17533
17541
|
*
|
|
@@ -17769,13 +17777,14 @@ class BaseGeminiNextGenAPIClient {
|
|
|
17769
17777
|
options.idempotencyKey = this.defaultIdempotencyKey();
|
|
17770
17778
|
idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey;
|
|
17771
17779
|
}
|
|
17772
|
-
const
|
|
17780
|
+
const authHeaders = await this.authHeaders(options);
|
|
17781
|
+
let headers = buildHeaders([
|
|
17773
17782
|
idempotencyHeaders,
|
|
17774
17783
|
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()),
|
|
17775
|
-
await this.authHeaders(options),
|
|
17776
17784
|
this._options.defaultHeaders,
|
|
17777
17785
|
bodyHeaders,
|
|
17778
17786
|
options.headers,
|
|
17787
|
+
authHeaders,
|
|
17779
17788
|
]);
|
|
17780
17789
|
this.validateHeaders(headers);
|
|
17781
17790
|
return headers.values;
|
|
@@ -19140,9 +19149,6 @@ class GoogleGenAI {
|
|
|
19140
19149
|
return this._interactions;
|
|
19141
19150
|
}
|
|
19142
19151
|
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
19143
|
-
if (this.vertexai) {
|
|
19144
|
-
throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
|
|
19145
|
-
}
|
|
19146
19152
|
const httpOpts = this.httpOptions;
|
|
19147
19153
|
// Unsupported Options Warnings
|
|
19148
19154
|
if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {
|
|
@@ -19151,6 +19157,8 @@ class GoogleGenAI {
|
|
|
19151
19157
|
const nextGenClient = new GeminiNextGenAPIClient({
|
|
19152
19158
|
baseURL: this.apiClient.getBaseUrl(),
|
|
19153
19159
|
apiKey: this.apiKey,
|
|
19160
|
+
apiVersion: this.apiClient.getApiVersion(),
|
|
19161
|
+
clientAdapter: this.apiClient,
|
|
19154
19162
|
defaultHeaders: this.apiClient.getDefaultHeaders(),
|
|
19155
19163
|
timeout: httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.timeout,
|
|
19156
19164
|
});
|
|
@@ -19205,5 +19213,5 @@ class GoogleGenAI {
|
|
|
19205
19213
|
}
|
|
19206
19214
|
}
|
|
19207
19215
|
|
|
19208
|
-
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,
|
|
19216
|
+
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 };
|
|
19209
19217
|
//# sourceMappingURL=index.mjs.map
|