@google/genai 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/genai.d.ts +215 -19
- package/dist/index.cjs +134 -29
- package/dist/index.mjs +135 -30
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +134 -29
- package/dist/node/index.mjs +135 -30
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +215 -19
- package/dist/tokenizer/node.cjs +56 -20
- package/dist/tokenizer/node.d.ts +41 -10
- package/dist/tokenizer/node.mjs +56 -20
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +57 -21
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +47 -15
- package/dist/vertex_internal/index.js +57 -21
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +135 -30
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +215 -19
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -704,26 +704,6 @@ exports.Type = void 0;
|
|
|
704
704
|
*/
|
|
705
705
|
Type["NULL"] = "NULL";
|
|
706
706
|
})(exports.Type || (exports.Type = {}));
|
|
707
|
-
/** The environment being operated. */
|
|
708
|
-
exports.Environment = void 0;
|
|
709
|
-
(function (Environment) {
|
|
710
|
-
/**
|
|
711
|
-
* Defaults to browser.
|
|
712
|
-
*/
|
|
713
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
714
|
-
/**
|
|
715
|
-
* Operates in a web browser.
|
|
716
|
-
*/
|
|
717
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
718
|
-
/**
|
|
719
|
-
* Operates in a mobile environment.
|
|
720
|
-
*/
|
|
721
|
-
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
722
|
-
/**
|
|
723
|
-
* Operates in a desktop environment.
|
|
724
|
-
*/
|
|
725
|
-
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
726
|
-
})(exports.Environment || (exports.Environment = {}));
|
|
727
707
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
728
708
|
exports.AuthType = void 0;
|
|
729
709
|
(function (AuthType) {
|
|
@@ -794,6 +774,62 @@ exports.ApiSpec = void 0;
|
|
|
794
774
|
*/
|
|
795
775
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
796
776
|
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
777
|
+
/** The environment being operated. */
|
|
778
|
+
exports.Environment = void 0;
|
|
779
|
+
(function (Environment) {
|
|
780
|
+
/**
|
|
781
|
+
* Defaults to browser.
|
|
782
|
+
*/
|
|
783
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
784
|
+
/**
|
|
785
|
+
* Operates in a web browser.
|
|
786
|
+
*/
|
|
787
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
788
|
+
/**
|
|
789
|
+
* Operates in a mobile environment.
|
|
790
|
+
*/
|
|
791
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
792
|
+
/**
|
|
793
|
+
* Operates in a desktop environment.
|
|
794
|
+
*/
|
|
795
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
796
|
+
})(exports.Environment || (exports.Environment = {}));
|
|
797
|
+
/** SafetyPolicy */
|
|
798
|
+
exports.SafetyPolicy = void 0;
|
|
799
|
+
(function (SafetyPolicy) {
|
|
800
|
+
/**
|
|
801
|
+
* Unspecified safety policy.
|
|
802
|
+
*/
|
|
803
|
+
SafetyPolicy["SAFETY_POLICY_UNSPECIFIED"] = "SAFETY_POLICY_UNSPECIFIED";
|
|
804
|
+
/**
|
|
805
|
+
* Safety policy for financial transactions.
|
|
806
|
+
*/
|
|
807
|
+
SafetyPolicy["FINANCIAL_TRANSACTIONS"] = "FINANCIAL_TRANSACTIONS";
|
|
808
|
+
/**
|
|
809
|
+
* Safety policy for sensitive data modification.
|
|
810
|
+
*/
|
|
811
|
+
SafetyPolicy["SENSITIVE_DATA_MODIFICATION"] = "SENSITIVE_DATA_MODIFICATION";
|
|
812
|
+
/**
|
|
813
|
+
* Safety policy for communication tools (e.g. Gmail, Chat, Meet).
|
|
814
|
+
*/
|
|
815
|
+
SafetyPolicy["COMMUNICATION_TOOL"] = "COMMUNICATION_TOOL";
|
|
816
|
+
/**
|
|
817
|
+
* Safety policy for account creation.
|
|
818
|
+
*/
|
|
819
|
+
SafetyPolicy["ACCOUNT_CREATION"] = "ACCOUNT_CREATION";
|
|
820
|
+
/**
|
|
821
|
+
* Safety policy for data modification.
|
|
822
|
+
*/
|
|
823
|
+
SafetyPolicy["DATA_MODIFICATION"] = "DATA_MODIFICATION";
|
|
824
|
+
/**
|
|
825
|
+
* Safety policy for user consent management.
|
|
826
|
+
*/
|
|
827
|
+
SafetyPolicy["USER_CONSENT_MANAGEMENT"] = "USER_CONSENT_MANAGEMENT";
|
|
828
|
+
/**
|
|
829
|
+
* Safety policy for legal terms and agreements.
|
|
830
|
+
*/
|
|
831
|
+
SafetyPolicy["LEGAL_TERMS_AND_AGREEMENTS"] = "LEGAL_TERMS_AND_AGREEMENTS";
|
|
832
|
+
})(exports.SafetyPolicy || (exports.SafetyPolicy = {}));
|
|
797
833
|
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
798
834
|
exports.PhishBlockThreshold = void 0;
|
|
799
835
|
(function (PhishBlockThreshold) {
|
|
@@ -5973,6 +6009,29 @@ function codeExecutionResultToVertex$3(fromObject) {
|
|
|
5973
6009
|
}
|
|
5974
6010
|
return toObject;
|
|
5975
6011
|
}
|
|
6012
|
+
function computerUseToVertex$2(fromObject) {
|
|
6013
|
+
const toObject = {};
|
|
6014
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
6015
|
+
if (fromEnvironment != null) {
|
|
6016
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
6017
|
+
}
|
|
6018
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
6019
|
+
'excludedPredefinedFunctions',
|
|
6020
|
+
]);
|
|
6021
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
6022
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
6023
|
+
}
|
|
6024
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
6025
|
+
'enablePromptInjectionDetection',
|
|
6026
|
+
]);
|
|
6027
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
6028
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
6029
|
+
}
|
|
6030
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
6031
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6032
|
+
}
|
|
6033
|
+
return toObject;
|
|
6034
|
+
}
|
|
5976
6035
|
function contentToMldev$3(fromObject) {
|
|
5977
6036
|
const toObject = {};
|
|
5978
6037
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6648,7 +6707,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6648
6707
|
}
|
|
6649
6708
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6650
6709
|
if (fromComputerUse != null) {
|
|
6651
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6710
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$2(fromComputerUse));
|
|
6652
6711
|
}
|
|
6653
6712
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6654
6713
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7715,7 +7774,7 @@ class Files extends BaseModule {
|
|
|
7715
7774
|
* file extension.
|
|
7716
7775
|
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
7717
7776
|
* property.
|
|
7718
|
-
*
|
|
7777
|
+
* Some examples for file extension to mimeType mapping:
|
|
7719
7778
|
* .txt -> text/plain
|
|
7720
7779
|
* .json -> application/json
|
|
7721
7780
|
* .jpg -> image/jpeg
|
|
@@ -8078,6 +8137,29 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
8078
8137
|
}
|
|
8079
8138
|
return toObject;
|
|
8080
8139
|
}
|
|
8140
|
+
function computerUseToVertex$1(fromObject) {
|
|
8141
|
+
const toObject = {};
|
|
8142
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8143
|
+
if (fromEnvironment != null) {
|
|
8144
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8145
|
+
}
|
|
8146
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
8147
|
+
'excludedPredefinedFunctions',
|
|
8148
|
+
]);
|
|
8149
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
8150
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
8151
|
+
}
|
|
8152
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
8153
|
+
'enablePromptInjectionDetection',
|
|
8154
|
+
]);
|
|
8155
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
8156
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
8157
|
+
}
|
|
8158
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
8159
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8160
|
+
}
|
|
8161
|
+
return toObject;
|
|
8162
|
+
}
|
|
8081
8163
|
function contentToMldev$2(fromObject) {
|
|
8082
8164
|
const toObject = {};
|
|
8083
8165
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -9036,7 +9118,7 @@ function toolToVertex$1(fromObject) {
|
|
|
9036
9118
|
}
|
|
9037
9119
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9038
9120
|
if (fromComputerUse != null) {
|
|
9039
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9121
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$1(fromComputerUse));
|
|
9040
9122
|
}
|
|
9041
9123
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
9042
9124
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9380,6 +9462,29 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9380
9462
|
}
|
|
9381
9463
|
return toObject;
|
|
9382
9464
|
}
|
|
9465
|
+
function computerUseToVertex(fromObject, _rootObject) {
|
|
9466
|
+
const toObject = {};
|
|
9467
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9468
|
+
if (fromEnvironment != null) {
|
|
9469
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9470
|
+
}
|
|
9471
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9472
|
+
'excludedPredefinedFunctions',
|
|
9473
|
+
]);
|
|
9474
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
9475
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9476
|
+
}
|
|
9477
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
9478
|
+
'enablePromptInjectionDetection',
|
|
9479
|
+
]);
|
|
9480
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
9481
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
9482
|
+
}
|
|
9483
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
9484
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9485
|
+
}
|
|
9486
|
+
return toObject;
|
|
9487
|
+
}
|
|
9383
9488
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9384
9489
|
const toObject = {};
|
|
9385
9490
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12458,7 +12563,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12458
12563
|
}
|
|
12459
12564
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12460
12565
|
if (fromComputerUse != null) {
|
|
12461
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12566
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex(fromComputerUse));
|
|
12462
12567
|
}
|
|
12463
12568
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12464
12569
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -13082,7 +13187,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13082
13187
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13083
13188
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13084
13189
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13085
|
-
const SDK_VERSION = '2.
|
|
13190
|
+
const SDK_VERSION = '2.10.0'; // x-release-please-version
|
|
13086
13191
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13087
13192
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13088
13193
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -14796,7 +14901,7 @@ class Models extends BaseModule {
|
|
|
14796
14901
|
this.generateContent = async (params) => {
|
|
14797
14902
|
var _a, _b, _c, _d, _e;
|
|
14798
14903
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14799
|
-
this.
|
|
14904
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14800
14905
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
14801
14906
|
return await this.generateContentInternal(transformedParams);
|
|
14802
14907
|
}
|
|
@@ -14888,7 +14993,7 @@ class Models extends BaseModule {
|
|
|
14888
14993
|
*/
|
|
14889
14994
|
this.generateContentStream = async (params) => {
|
|
14890
14995
|
var _a, _b, _c, _d, _e;
|
|
14891
|
-
this.
|
|
14996
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14892
14997
|
if (shouldDisableAfc(params.config)) {
|
|
14893
14998
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14894
14999
|
return await this.generateContentStreamInternal(transformedParams);
|
|
@@ -15113,7 +15218,7 @@ class Models extends BaseModule {
|
|
|
15113
15218
|
* To maintain backward compatibility, we move the data that was treated as
|
|
15114
15219
|
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
15115
15220
|
*/
|
|
15116
|
-
|
|
15221
|
+
maybeMoveToResponseJsonSchema(params) {
|
|
15117
15222
|
if (params.config && params.config.responseSchema) {
|
|
15118
15223
|
if (!params.config.responseJsonSchema) {
|
|
15119
15224
|
if (Object.keys(params.config.responseSchema).includes('$schema')) {
|
|
@@ -15215,7 +15320,7 @@ class Models extends BaseModule {
|
|
|
15215
15320
|
throw new Error('Function call name was not returned by the model.');
|
|
15216
15321
|
}
|
|
15217
15322
|
if (!afcTools.has(part.functionCall.name)) {
|
|
15218
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()},
|
|
15323
|
+
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()}, missing tool: ${part.functionCall.name}`);
|
|
15219
15324
|
}
|
|
15220
15325
|
else {
|
|
15221
15326
|
const responseParts = yield __await(afcTools
|
package/dist/node/index.mjs
CHANGED
|
@@ -682,26 +682,6 @@ var Type;
|
|
|
682
682
|
*/
|
|
683
683
|
Type["NULL"] = "NULL";
|
|
684
684
|
})(Type || (Type = {}));
|
|
685
|
-
/** The environment being operated. */
|
|
686
|
-
var Environment;
|
|
687
|
-
(function (Environment) {
|
|
688
|
-
/**
|
|
689
|
-
* Defaults to browser.
|
|
690
|
-
*/
|
|
691
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
692
|
-
/**
|
|
693
|
-
* Operates in a web browser.
|
|
694
|
-
*/
|
|
695
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
696
|
-
/**
|
|
697
|
-
* Operates in a mobile environment.
|
|
698
|
-
*/
|
|
699
|
-
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
700
|
-
/**
|
|
701
|
-
* Operates in a desktop environment.
|
|
702
|
-
*/
|
|
703
|
-
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
704
|
-
})(Environment || (Environment = {}));
|
|
705
685
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
706
686
|
var AuthType;
|
|
707
687
|
(function (AuthType) {
|
|
@@ -772,6 +752,62 @@ var ApiSpec;
|
|
|
772
752
|
*/
|
|
773
753
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
774
754
|
})(ApiSpec || (ApiSpec = {}));
|
|
755
|
+
/** The environment being operated. */
|
|
756
|
+
var Environment;
|
|
757
|
+
(function (Environment) {
|
|
758
|
+
/**
|
|
759
|
+
* Defaults to browser.
|
|
760
|
+
*/
|
|
761
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
762
|
+
/**
|
|
763
|
+
* Operates in a web browser.
|
|
764
|
+
*/
|
|
765
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
766
|
+
/**
|
|
767
|
+
* Operates in a mobile environment.
|
|
768
|
+
*/
|
|
769
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
770
|
+
/**
|
|
771
|
+
* Operates in a desktop environment.
|
|
772
|
+
*/
|
|
773
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
774
|
+
})(Environment || (Environment = {}));
|
|
775
|
+
/** SafetyPolicy */
|
|
776
|
+
var SafetyPolicy;
|
|
777
|
+
(function (SafetyPolicy) {
|
|
778
|
+
/**
|
|
779
|
+
* Unspecified safety policy.
|
|
780
|
+
*/
|
|
781
|
+
SafetyPolicy["SAFETY_POLICY_UNSPECIFIED"] = "SAFETY_POLICY_UNSPECIFIED";
|
|
782
|
+
/**
|
|
783
|
+
* Safety policy for financial transactions.
|
|
784
|
+
*/
|
|
785
|
+
SafetyPolicy["FINANCIAL_TRANSACTIONS"] = "FINANCIAL_TRANSACTIONS";
|
|
786
|
+
/**
|
|
787
|
+
* Safety policy for sensitive data modification.
|
|
788
|
+
*/
|
|
789
|
+
SafetyPolicy["SENSITIVE_DATA_MODIFICATION"] = "SENSITIVE_DATA_MODIFICATION";
|
|
790
|
+
/**
|
|
791
|
+
* Safety policy for communication tools (e.g. Gmail, Chat, Meet).
|
|
792
|
+
*/
|
|
793
|
+
SafetyPolicy["COMMUNICATION_TOOL"] = "COMMUNICATION_TOOL";
|
|
794
|
+
/**
|
|
795
|
+
* Safety policy for account creation.
|
|
796
|
+
*/
|
|
797
|
+
SafetyPolicy["ACCOUNT_CREATION"] = "ACCOUNT_CREATION";
|
|
798
|
+
/**
|
|
799
|
+
* Safety policy for data modification.
|
|
800
|
+
*/
|
|
801
|
+
SafetyPolicy["DATA_MODIFICATION"] = "DATA_MODIFICATION";
|
|
802
|
+
/**
|
|
803
|
+
* Safety policy for user consent management.
|
|
804
|
+
*/
|
|
805
|
+
SafetyPolicy["USER_CONSENT_MANAGEMENT"] = "USER_CONSENT_MANAGEMENT";
|
|
806
|
+
/**
|
|
807
|
+
* Safety policy for legal terms and agreements.
|
|
808
|
+
*/
|
|
809
|
+
SafetyPolicy["LEGAL_TERMS_AND_AGREEMENTS"] = "LEGAL_TERMS_AND_AGREEMENTS";
|
|
810
|
+
})(SafetyPolicy || (SafetyPolicy = {}));
|
|
775
811
|
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
776
812
|
var PhishBlockThreshold;
|
|
777
813
|
(function (PhishBlockThreshold) {
|
|
@@ -5951,6 +5987,29 @@ function codeExecutionResultToVertex$3(fromObject) {
|
|
|
5951
5987
|
}
|
|
5952
5988
|
return toObject;
|
|
5953
5989
|
}
|
|
5990
|
+
function computerUseToVertex$2(fromObject) {
|
|
5991
|
+
const toObject = {};
|
|
5992
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5993
|
+
if (fromEnvironment != null) {
|
|
5994
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5995
|
+
}
|
|
5996
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5997
|
+
'excludedPredefinedFunctions',
|
|
5998
|
+
]);
|
|
5999
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
6000
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
6001
|
+
}
|
|
6002
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
6003
|
+
'enablePromptInjectionDetection',
|
|
6004
|
+
]);
|
|
6005
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
6006
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
6007
|
+
}
|
|
6008
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
6009
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6010
|
+
}
|
|
6011
|
+
return toObject;
|
|
6012
|
+
}
|
|
5954
6013
|
function contentToMldev$3(fromObject) {
|
|
5955
6014
|
const toObject = {};
|
|
5956
6015
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6626,7 +6685,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6626
6685
|
}
|
|
6627
6686
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6628
6687
|
if (fromComputerUse != null) {
|
|
6629
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6688
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$2(fromComputerUse));
|
|
6630
6689
|
}
|
|
6631
6690
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6632
6691
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7693,7 +7752,7 @@ class Files extends BaseModule {
|
|
|
7693
7752
|
* file extension.
|
|
7694
7753
|
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
7695
7754
|
* property.
|
|
7696
|
-
*
|
|
7755
|
+
* Some examples for file extension to mimeType mapping:
|
|
7697
7756
|
* .txt -> text/plain
|
|
7698
7757
|
* .json -> application/json
|
|
7699
7758
|
* .jpg -> image/jpeg
|
|
@@ -8056,6 +8115,29 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
8056
8115
|
}
|
|
8057
8116
|
return toObject;
|
|
8058
8117
|
}
|
|
8118
|
+
function computerUseToVertex$1(fromObject) {
|
|
8119
|
+
const toObject = {};
|
|
8120
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8121
|
+
if (fromEnvironment != null) {
|
|
8122
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8123
|
+
}
|
|
8124
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
8125
|
+
'excludedPredefinedFunctions',
|
|
8126
|
+
]);
|
|
8127
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
8128
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
8129
|
+
}
|
|
8130
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
8131
|
+
'enablePromptInjectionDetection',
|
|
8132
|
+
]);
|
|
8133
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
8134
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
8135
|
+
}
|
|
8136
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
8137
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8138
|
+
}
|
|
8139
|
+
return toObject;
|
|
8140
|
+
}
|
|
8059
8141
|
function contentToMldev$2(fromObject) {
|
|
8060
8142
|
const toObject = {};
|
|
8061
8143
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -9014,7 +9096,7 @@ function toolToVertex$1(fromObject) {
|
|
|
9014
9096
|
}
|
|
9015
9097
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
9016
9098
|
if (fromComputerUse != null) {
|
|
9017
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9099
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$1(fromComputerUse));
|
|
9018
9100
|
}
|
|
9019
9101
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
9020
9102
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9358,6 +9440,29 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9358
9440
|
}
|
|
9359
9441
|
return toObject;
|
|
9360
9442
|
}
|
|
9443
|
+
function computerUseToVertex(fromObject, _rootObject) {
|
|
9444
|
+
const toObject = {};
|
|
9445
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9446
|
+
if (fromEnvironment != null) {
|
|
9447
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9448
|
+
}
|
|
9449
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9450
|
+
'excludedPredefinedFunctions',
|
|
9451
|
+
]);
|
|
9452
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
9453
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9454
|
+
}
|
|
9455
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
9456
|
+
'enablePromptInjectionDetection',
|
|
9457
|
+
]);
|
|
9458
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
9459
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
9460
|
+
}
|
|
9461
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
9462
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9463
|
+
}
|
|
9464
|
+
return toObject;
|
|
9465
|
+
}
|
|
9361
9466
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9362
9467
|
const toObject = {};
|
|
9363
9468
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12436,7 +12541,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12436
12541
|
}
|
|
12437
12542
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12438
12543
|
if (fromComputerUse != null) {
|
|
12439
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12544
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex(fromComputerUse));
|
|
12440
12545
|
}
|
|
12441
12546
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12442
12547
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -13060,7 +13165,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13060
13165
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13061
13166
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13062
13167
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13063
|
-
const SDK_VERSION = '2.
|
|
13168
|
+
const SDK_VERSION = '2.10.0'; // x-release-please-version
|
|
13064
13169
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13065
13170
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13066
13171
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -14774,7 +14879,7 @@ class Models extends BaseModule {
|
|
|
14774
14879
|
this.generateContent = async (params) => {
|
|
14775
14880
|
var _a, _b, _c, _d, _e;
|
|
14776
14881
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14777
|
-
this.
|
|
14882
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14778
14883
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
14779
14884
|
return await this.generateContentInternal(transformedParams);
|
|
14780
14885
|
}
|
|
@@ -14866,7 +14971,7 @@ class Models extends BaseModule {
|
|
|
14866
14971
|
*/
|
|
14867
14972
|
this.generateContentStream = async (params) => {
|
|
14868
14973
|
var _a, _b, _c, _d, _e;
|
|
14869
|
-
this.
|
|
14974
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14870
14975
|
if (shouldDisableAfc(params.config)) {
|
|
14871
14976
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14872
14977
|
return await this.generateContentStreamInternal(transformedParams);
|
|
@@ -15091,7 +15196,7 @@ class Models extends BaseModule {
|
|
|
15091
15196
|
* To maintain backward compatibility, we move the data that was treated as
|
|
15092
15197
|
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
15093
15198
|
*/
|
|
15094
|
-
|
|
15199
|
+
maybeMoveToResponseJsonSchema(params) {
|
|
15095
15200
|
if (params.config && params.config.responseSchema) {
|
|
15096
15201
|
if (!params.config.responseJsonSchema) {
|
|
15097
15202
|
if (Object.keys(params.config.responseSchema).includes('$schema')) {
|
|
@@ -15193,7 +15298,7 @@ class Models extends BaseModule {
|
|
|
15193
15298
|
throw new Error('Function call name was not returned by the model.');
|
|
15194
15299
|
}
|
|
15195
15300
|
if (!afcTools.has(part.functionCall.name)) {
|
|
15196
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()},
|
|
15301
|
+
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()}, missing tool: ${part.functionCall.name}`);
|
|
15197
15302
|
}
|
|
15198
15303
|
else {
|
|
15199
15304
|
const responseParts = yield __await(afcTools
|
|
@@ -24614,5 +24719,5 @@ function getApiKeyFromEnv() {
|
|
|
24614
24719
|
return envGoogleApiKey || envGeminiApiKey || undefined;
|
|
24615
24720
|
}
|
|
24616
24721
|
|
|
24617
|
-
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, 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, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MatchOperation, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReinforcementTuningAutoraterScorerParsedResponseConversionScorer, ReinforcementTuningParseResponseConfig, ReinforcementTuningThinkingLevel, ReplayResponse, ResourceScope, ResponseParseType, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, ValidateRewardResponse, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
24722
|
+
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, 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, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MatchOperation, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReinforcementTuningAutoraterScorerParsedResponseConversionScorer, ReinforcementTuningParseResponseConfig, ReinforcementTuningThinkingLevel, ReplayResponse, ResourceScope, ResponseParseType, SafetyFilterLevel, SafetyPolicy, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, ValidateRewardResponse, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
24618
24723
|
//# sourceMappingURL=index.mjs.map
|