@google/genai 2.9.0-rc.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/README.md +1 -4
- package/dist/genai.d.ts +570 -363
- package/dist/index.cjs +283 -120
- package/dist/index.mjs +284 -121
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +283 -120
- package/dist/node/index.mjs +284 -121
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +570 -363
- 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 +71 -18
- package/dist/vertex_internal/index.js +57 -21
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +284 -121
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +570 -363
- package/package.json +1 -1
package/dist/web/index.mjs
CHANGED
|
@@ -674,26 +674,6 @@ var Type;
|
|
|
674
674
|
*/
|
|
675
675
|
Type["NULL"] = "NULL";
|
|
676
676
|
})(Type || (Type = {}));
|
|
677
|
-
/** The environment being operated. */
|
|
678
|
-
var Environment;
|
|
679
|
-
(function (Environment) {
|
|
680
|
-
/**
|
|
681
|
-
* Defaults to browser.
|
|
682
|
-
*/
|
|
683
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
684
|
-
/**
|
|
685
|
-
* Operates in a web browser.
|
|
686
|
-
*/
|
|
687
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
688
|
-
/**
|
|
689
|
-
* Operates in a mobile environment.
|
|
690
|
-
*/
|
|
691
|
-
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
692
|
-
/**
|
|
693
|
-
* Operates in a desktop environment.
|
|
694
|
-
*/
|
|
695
|
-
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
696
|
-
})(Environment || (Environment = {}));
|
|
697
677
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
698
678
|
var AuthType;
|
|
699
679
|
(function (AuthType) {
|
|
@@ -764,6 +744,62 @@ var ApiSpec;
|
|
|
764
744
|
*/
|
|
765
745
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
766
746
|
})(ApiSpec || (ApiSpec = {}));
|
|
747
|
+
/** The environment being operated. */
|
|
748
|
+
var Environment;
|
|
749
|
+
(function (Environment) {
|
|
750
|
+
/**
|
|
751
|
+
* Defaults to browser.
|
|
752
|
+
*/
|
|
753
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
754
|
+
/**
|
|
755
|
+
* Operates in a web browser.
|
|
756
|
+
*/
|
|
757
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
758
|
+
/**
|
|
759
|
+
* Operates in a mobile environment.
|
|
760
|
+
*/
|
|
761
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
762
|
+
/**
|
|
763
|
+
* Operates in a desktop environment.
|
|
764
|
+
*/
|
|
765
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
766
|
+
})(Environment || (Environment = {}));
|
|
767
|
+
/** SafetyPolicy */
|
|
768
|
+
var SafetyPolicy;
|
|
769
|
+
(function (SafetyPolicy) {
|
|
770
|
+
/**
|
|
771
|
+
* Unspecified safety policy.
|
|
772
|
+
*/
|
|
773
|
+
SafetyPolicy["SAFETY_POLICY_UNSPECIFIED"] = "SAFETY_POLICY_UNSPECIFIED";
|
|
774
|
+
/**
|
|
775
|
+
* Safety policy for financial transactions.
|
|
776
|
+
*/
|
|
777
|
+
SafetyPolicy["FINANCIAL_TRANSACTIONS"] = "FINANCIAL_TRANSACTIONS";
|
|
778
|
+
/**
|
|
779
|
+
* Safety policy for sensitive data modification.
|
|
780
|
+
*/
|
|
781
|
+
SafetyPolicy["SENSITIVE_DATA_MODIFICATION"] = "SENSITIVE_DATA_MODIFICATION";
|
|
782
|
+
/**
|
|
783
|
+
* Safety policy for communication tools (e.g. Gmail, Chat, Meet).
|
|
784
|
+
*/
|
|
785
|
+
SafetyPolicy["COMMUNICATION_TOOL"] = "COMMUNICATION_TOOL";
|
|
786
|
+
/**
|
|
787
|
+
* Safety policy for account creation.
|
|
788
|
+
*/
|
|
789
|
+
SafetyPolicy["ACCOUNT_CREATION"] = "ACCOUNT_CREATION";
|
|
790
|
+
/**
|
|
791
|
+
* Safety policy for data modification.
|
|
792
|
+
*/
|
|
793
|
+
SafetyPolicy["DATA_MODIFICATION"] = "DATA_MODIFICATION";
|
|
794
|
+
/**
|
|
795
|
+
* Safety policy for user consent management.
|
|
796
|
+
*/
|
|
797
|
+
SafetyPolicy["USER_CONSENT_MANAGEMENT"] = "USER_CONSENT_MANAGEMENT";
|
|
798
|
+
/**
|
|
799
|
+
* Safety policy for legal terms and agreements.
|
|
800
|
+
*/
|
|
801
|
+
SafetyPolicy["LEGAL_TERMS_AND_AGREEMENTS"] = "LEGAL_TERMS_AND_AGREEMENTS";
|
|
802
|
+
})(SafetyPolicy || (SafetyPolicy = {}));
|
|
767
803
|
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
768
804
|
var PhishBlockThreshold;
|
|
769
805
|
(function (PhishBlockThreshold) {
|
|
@@ -5943,6 +5979,29 @@ function codeExecutionResultToVertex$3(fromObject) {
|
|
|
5943
5979
|
}
|
|
5944
5980
|
return toObject;
|
|
5945
5981
|
}
|
|
5982
|
+
function computerUseToVertex$2(fromObject) {
|
|
5983
|
+
const toObject = {};
|
|
5984
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5985
|
+
if (fromEnvironment != null) {
|
|
5986
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5987
|
+
}
|
|
5988
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5989
|
+
'excludedPredefinedFunctions',
|
|
5990
|
+
]);
|
|
5991
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
5992
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5993
|
+
}
|
|
5994
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
5995
|
+
'enablePromptInjectionDetection',
|
|
5996
|
+
]);
|
|
5997
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
5998
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
5999
|
+
}
|
|
6000
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
6001
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
6002
|
+
}
|
|
6003
|
+
return toObject;
|
|
6004
|
+
}
|
|
5946
6005
|
function contentToMldev$3(fromObject) {
|
|
5947
6006
|
const toObject = {};
|
|
5948
6007
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6618,7 +6677,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6618
6677
|
}
|
|
6619
6678
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6620
6679
|
if (fromComputerUse != null) {
|
|
6621
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6680
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$2(fromComputerUse));
|
|
6622
6681
|
}
|
|
6623
6682
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6624
6683
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7685,7 +7744,7 @@ class Files extends BaseModule {
|
|
|
7685
7744
|
* file extension.
|
|
7686
7745
|
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
7687
7746
|
* property.
|
|
7688
|
-
*
|
|
7747
|
+
* Some examples for file extension to mimeType mapping:
|
|
7689
7748
|
* .txt -> text/plain
|
|
7690
7749
|
* .json -> application/json
|
|
7691
7750
|
* .jpg -> image/jpeg
|
|
@@ -7973,6 +8032,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
|
|
|
7973
8032
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
7974
8033
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
7975
8034
|
}
|
|
8035
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
8036
|
+
if (fromLanguageAuto != null) {
|
|
8037
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
8038
|
+
}
|
|
8039
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
8040
|
+
'languageHints',
|
|
8041
|
+
]);
|
|
8042
|
+
if (fromLanguageHints != null) {
|
|
8043
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
8044
|
+
}
|
|
8045
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
8046
|
+
'adaptationPhrases',
|
|
8047
|
+
]);
|
|
8048
|
+
if (fromAdaptationPhrases != null) {
|
|
8049
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
8050
|
+
}
|
|
7976
8051
|
return toObject;
|
|
7977
8052
|
}
|
|
7978
8053
|
function authConfigToMldev$2(fromObject) {
|
|
@@ -8032,6 +8107,29 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
8032
8107
|
}
|
|
8033
8108
|
return toObject;
|
|
8034
8109
|
}
|
|
8110
|
+
function computerUseToVertex$1(fromObject) {
|
|
8111
|
+
const toObject = {};
|
|
8112
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
8113
|
+
if (fromEnvironment != null) {
|
|
8114
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
8115
|
+
}
|
|
8116
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
8117
|
+
'excludedPredefinedFunctions',
|
|
8118
|
+
]);
|
|
8119
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
8120
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
8121
|
+
}
|
|
8122
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
8123
|
+
'enablePromptInjectionDetection',
|
|
8124
|
+
]);
|
|
8125
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
8126
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
8127
|
+
}
|
|
8128
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
8129
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8130
|
+
}
|
|
8131
|
+
return toObject;
|
|
8132
|
+
}
|
|
8035
8133
|
function contentToMldev$2(fromObject) {
|
|
8036
8134
|
const toObject = {};
|
|
8037
8135
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -8990,7 +9088,7 @@ function toolToVertex$1(fromObject) {
|
|
|
8990
9088
|
}
|
|
8991
9089
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
8992
9090
|
if (fromComputerUse != null) {
|
|
8993
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
9091
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$1(fromComputerUse));
|
|
8994
9092
|
}
|
|
8995
9093
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
8996
9094
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -9153,6 +9251,10 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
9153
9251
|
if (fromVoiceActivityType != null) {
|
|
9154
9252
|
setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
|
|
9155
9253
|
}
|
|
9254
|
+
const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
|
|
9255
|
+
if (fromAudioOffset != null) {
|
|
9256
|
+
setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
|
|
9257
|
+
}
|
|
9156
9258
|
return toObject;
|
|
9157
9259
|
}
|
|
9158
9260
|
|
|
@@ -9330,6 +9432,29 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
9330
9432
|
}
|
|
9331
9433
|
return toObject;
|
|
9332
9434
|
}
|
|
9435
|
+
function computerUseToVertex(fromObject, _rootObject) {
|
|
9436
|
+
const toObject = {};
|
|
9437
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
9438
|
+
if (fromEnvironment != null) {
|
|
9439
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
9440
|
+
}
|
|
9441
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
9442
|
+
'excludedPredefinedFunctions',
|
|
9443
|
+
]);
|
|
9444
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
9445
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
9446
|
+
}
|
|
9447
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
9448
|
+
'enablePromptInjectionDetection',
|
|
9449
|
+
]);
|
|
9450
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
9451
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
9452
|
+
}
|
|
9453
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
9454
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
9455
|
+
}
|
|
9456
|
+
return toObject;
|
|
9457
|
+
}
|
|
9333
9458
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
9334
9459
|
const toObject = {};
|
|
9335
9460
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -12408,7 +12533,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
12408
12533
|
}
|
|
12409
12534
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
12410
12535
|
if (fromComputerUse != null) {
|
|
12411
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
12536
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex(fromComputerUse));
|
|
12412
12537
|
}
|
|
12413
12538
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
12414
12539
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -13032,7 +13157,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13032
13157
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13033
13158
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13034
13159
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13035
|
-
const SDK_VERSION = '2.
|
|
13160
|
+
const SDK_VERSION = '2.10.0'; // x-release-please-version
|
|
13036
13161
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13037
13162
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13038
13163
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -14746,7 +14871,7 @@ class Models extends BaseModule {
|
|
|
14746
14871
|
this.generateContent = async (params) => {
|
|
14747
14872
|
var _a, _b, _c, _d, _e;
|
|
14748
14873
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14749
|
-
this.
|
|
14874
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14750
14875
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
14751
14876
|
return await this.generateContentInternal(transformedParams);
|
|
14752
14877
|
}
|
|
@@ -14838,7 +14963,7 @@ class Models extends BaseModule {
|
|
|
14838
14963
|
*/
|
|
14839
14964
|
this.generateContentStream = async (params) => {
|
|
14840
14965
|
var _a, _b, _c, _d, _e;
|
|
14841
|
-
this.
|
|
14966
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
14842
14967
|
if (shouldDisableAfc(params.config)) {
|
|
14843
14968
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
14844
14969
|
return await this.generateContentStreamInternal(transformedParams);
|
|
@@ -15063,7 +15188,7 @@ class Models extends BaseModule {
|
|
|
15063
15188
|
* To maintain backward compatibility, we move the data that was treated as
|
|
15064
15189
|
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
15065
15190
|
*/
|
|
15066
|
-
|
|
15191
|
+
maybeMoveToResponseJsonSchema(params) {
|
|
15067
15192
|
if (params.config && params.config.responseSchema) {
|
|
15068
15193
|
if (!params.config.responseJsonSchema) {
|
|
15069
15194
|
if (Object.keys(params.config.responseSchema).includes('$schema')) {
|
|
@@ -15165,7 +15290,7 @@ class Models extends BaseModule {
|
|
|
15165
15290
|
throw new Error('Function call name was not returned by the model.');
|
|
15166
15291
|
}
|
|
15167
15292
|
if (!afcTools.has(part.functionCall.name)) {
|
|
15168
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()},
|
|
15293
|
+
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}`);
|
|
15169
15294
|
}
|
|
15170
15295
|
else {
|
|
15171
15296
|
const responseParts = yield __await(afcTools
|
|
@@ -16386,6 +16511,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
|
|
|
16386
16511
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
16387
16512
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
16388
16513
|
}
|
|
16514
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
16515
|
+
if (fromLanguageAuto != null) {
|
|
16516
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
16517
|
+
}
|
|
16518
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
16519
|
+
'languageHints',
|
|
16520
|
+
]);
|
|
16521
|
+
if (fromLanguageHints != null) {
|
|
16522
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
16523
|
+
}
|
|
16524
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
16525
|
+
'adaptationPhrases',
|
|
16526
|
+
]);
|
|
16527
|
+
if (fromAdaptationPhrases != null) {
|
|
16528
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
16529
|
+
}
|
|
16389
16530
|
return toObject;
|
|
16390
16531
|
}
|
|
16391
16532
|
function authConfigToMldev(fromObject) {
|
|
@@ -17992,15 +18133,6 @@ class GoogleGenAiError extends Error {
|
|
|
17992
18133
|
* g3-prettier-ignore-file
|
|
17993
18134
|
*/
|
|
17994
18135
|
class GeminiNextGenAPIClientError extends Error {
|
|
17995
|
-
static [Symbol.hasInstance](instance) {
|
|
17996
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
17997
|
-
return true;
|
|
17998
|
-
}
|
|
17999
|
-
if (this === GeminiNextGenAPIClientError) {
|
|
18000
|
-
return isKnownLegacyErrorLike(instance);
|
|
18001
|
-
}
|
|
18002
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
18003
|
-
}
|
|
18004
18136
|
}
|
|
18005
18137
|
/** General errors raised by the GenAI API. */
|
|
18006
18138
|
class APIError extends GeminiNextGenAPIClientError {
|
|
@@ -18015,6 +18147,7 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
18015
18147
|
this.rawResponse = undefined;
|
|
18016
18148
|
this.cause = undefined;
|
|
18017
18149
|
this.name = this.constructor.name;
|
|
18150
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
18018
18151
|
}
|
|
18019
18152
|
static makeMessage(status, error, message) {
|
|
18020
18153
|
var _a;
|
|
@@ -18026,15 +18159,6 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
18026
18159
|
const statusText = status ? `${status} ` : "";
|
|
18027
18160
|
return `${statusText}${msg}`;
|
|
18028
18161
|
}
|
|
18029
|
-
static [Symbol.hasInstance](instance) {
|
|
18030
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
18031
|
-
return true;
|
|
18032
|
-
}
|
|
18033
|
-
if (this === APIError) {
|
|
18034
|
-
return isAPIErrorLike(instance);
|
|
18035
|
-
}
|
|
18036
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
18037
|
-
}
|
|
18038
18162
|
static generate(status, errorResponse, message, headers) {
|
|
18039
18163
|
if (!status || !headers) {
|
|
18040
18164
|
return new APIConnectionError({
|
|
@@ -18175,57 +18299,12 @@ function stringifyErrorBody(error) {
|
|
|
18175
18299
|
function isPlainObject$2(value) {
|
|
18176
18300
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18177
18301
|
}
|
|
18178
|
-
function isLegacyErrorLike(value) {
|
|
18179
|
-
if (!(value instanceof Error) || !isPlainObject$2(value)) {
|
|
18180
|
-
return false;
|
|
18181
|
-
}
|
|
18182
|
-
return ("status" in value ||
|
|
18183
|
-
"statusCode" in value ||
|
|
18184
|
-
"error" in value ||
|
|
18185
|
-
"headers" in value);
|
|
18186
|
-
}
|
|
18187
|
-
function isAPIErrorLike(value) {
|
|
18188
|
-
return isLegacyErrorLike(value) && "error" in value;
|
|
18189
|
-
}
|
|
18190
18302
|
function isCompatAPIErrorInstance(value) {
|
|
18303
|
+
// Avoid instanceof here so this guard never depends on Symbol.hasInstance.
|
|
18191
18304
|
return typeof value === "object" && value !== null
|
|
18192
18305
|
? APIError.prototype.isPrototypeOf(value)
|
|
18193
18306
|
: false;
|
|
18194
18307
|
}
|
|
18195
|
-
const knownLegacyErrorNames = [
|
|
18196
|
-
"GeminiNextGenAPIClientError",
|
|
18197
|
-
"APIError",
|
|
18198
|
-
"APIUserAbortError",
|
|
18199
|
-
"APIConnectionError",
|
|
18200
|
-
"APIConnectionTimeoutError",
|
|
18201
|
-
"BadRequestError",
|
|
18202
|
-
"AuthenticationError",
|
|
18203
|
-
"PermissionDeniedError",
|
|
18204
|
-
"NotFoundError",
|
|
18205
|
-
"ConflictError",
|
|
18206
|
-
"UnprocessableEntityError",
|
|
18207
|
-
"RateLimitError",
|
|
18208
|
-
"InternalServerError",
|
|
18209
|
-
];
|
|
18210
|
-
const legacySubclassNamesByBaseName = {
|
|
18211
|
-
GeminiNextGenAPIClientError: knownLegacyErrorNames,
|
|
18212
|
-
APIConnectionError: ["APIConnectionTimeoutError"],
|
|
18213
|
-
};
|
|
18214
|
-
function isKnownLegacyErrorLike(value) {
|
|
18215
|
-
if (!isLegacyErrorLike(value)) {
|
|
18216
|
-
return false;
|
|
18217
|
-
}
|
|
18218
|
-
return knownLegacyErrorNames.includes(value.name);
|
|
18219
|
-
}
|
|
18220
|
-
function isNamedLegacyErrorLike(value, name) {
|
|
18221
|
-
var _a, _b;
|
|
18222
|
-
if (!isLegacyErrorLike(value)) {
|
|
18223
|
-
return false;
|
|
18224
|
-
}
|
|
18225
|
-
const valueName = value.name;
|
|
18226
|
-
return (valueName === name ||
|
|
18227
|
-
((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
|
|
18228
|
-
}
|
|
18229
18308
|
function defineReadonly(target, key, value) {
|
|
18230
18309
|
Object.defineProperty(target, key, {
|
|
18231
18310
|
configurable: true,
|
|
@@ -18435,7 +18514,7 @@ function serverURLFromOptions(options) {
|
|
|
18435
18514
|
return new URL(u);
|
|
18436
18515
|
}
|
|
18437
18516
|
const SDK_METADATA = {
|
|
18438
|
-
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.
|
|
18517
|
+
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
|
|
18439
18518
|
};
|
|
18440
18519
|
|
|
18441
18520
|
/**
|
|
@@ -18984,14 +19063,19 @@ async function retry(fetchFn, options) {
|
|
|
18984
19063
|
statusCodes: options.statusCodes,
|
|
18985
19064
|
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
18986
19065
|
}), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
|
|
19066
|
+
case "attempt-count-backoff":
|
|
19067
|
+
return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
|
|
19068
|
+
statusCodes: options.statusCodes,
|
|
19069
|
+
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
19070
|
+
}), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
|
|
18987
19071
|
default:
|
|
18988
|
-
return await fetchFn();
|
|
19072
|
+
return await fetchFn(0);
|
|
18989
19073
|
}
|
|
18990
19074
|
}
|
|
18991
19075
|
function wrapFetcher(fn, options) {
|
|
18992
|
-
return async () => {
|
|
19076
|
+
return async (attempt) => {
|
|
18993
19077
|
try {
|
|
18994
|
-
const res = await fn();
|
|
19078
|
+
const res = await fn(attempt);
|
|
18995
19079
|
if (isRetryableResponse(res, options.statusCodes)) {
|
|
18996
19080
|
throw new TemporaryError("Response failed with retryable status code", res);
|
|
18997
19081
|
}
|
|
@@ -19033,7 +19117,7 @@ async function retryBackoff(fn, strategy) {
|
|
|
19033
19117
|
let x = 0;
|
|
19034
19118
|
while (true) {
|
|
19035
19119
|
try {
|
|
19036
|
-
const res = await fn();
|
|
19120
|
+
const res = await fn(x);
|
|
19037
19121
|
return res;
|
|
19038
19122
|
}
|
|
19039
19123
|
catch (err) {
|
|
@@ -19061,7 +19145,46 @@ async function retryBackoff(fn, strategy) {
|
|
|
19061
19145
|
}
|
|
19062
19146
|
}
|
|
19063
19147
|
}
|
|
19148
|
+
async function retryAttemptCountBackoff(fn, strategy, config) {
|
|
19149
|
+
let attempt = 0;
|
|
19150
|
+
while (true) {
|
|
19151
|
+
try {
|
|
19152
|
+
return await fn(attempt);
|
|
19153
|
+
}
|
|
19154
|
+
catch (err) {
|
|
19155
|
+
if (err instanceof PermanentError) {
|
|
19156
|
+
throw err.cause;
|
|
19157
|
+
}
|
|
19158
|
+
if (attempt >= config.maxRetries) {
|
|
19159
|
+
if (err instanceof TemporaryError) {
|
|
19160
|
+
return err.response;
|
|
19161
|
+
}
|
|
19162
|
+
throw err;
|
|
19163
|
+
}
|
|
19164
|
+
let retryInterval = 0;
|
|
19165
|
+
if (err instanceof TemporaryError) {
|
|
19166
|
+
retryInterval = retryIntervalFromResponse(err.response);
|
|
19167
|
+
}
|
|
19168
|
+
if (retryInterval <= 0) {
|
|
19169
|
+
retryInterval =
|
|
19170
|
+
strategy.initialInterval *
|
|
19171
|
+
Math.pow(strategy.exponent, attempt) *
|
|
19172
|
+
(1 - Math.random() * 0.25);
|
|
19173
|
+
}
|
|
19174
|
+
const d = Math.min(retryInterval, strategy.maxInterval);
|
|
19175
|
+
await delay(d);
|
|
19176
|
+
attempt++;
|
|
19177
|
+
}
|
|
19178
|
+
}
|
|
19179
|
+
}
|
|
19064
19180
|
function retryIntervalFromResponse(res) {
|
|
19181
|
+
const retryAfterMsVal = res.headers.get("retry-after-ms");
|
|
19182
|
+
if (retryAfterMsVal) {
|
|
19183
|
+
const parsedMs = Number(retryAfterMsVal);
|
|
19184
|
+
if (Number.isFinite(parsedMs) && parsedMs >= 0) {
|
|
19185
|
+
return parsedMs;
|
|
19186
|
+
}
|
|
19187
|
+
}
|
|
19065
19188
|
const retryVal = res.headers.get("retry-after") || "";
|
|
19066
19189
|
if (!retryVal) {
|
|
19067
19190
|
return 0;
|
|
@@ -19516,13 +19639,12 @@ class Stream extends ReadableStream {
|
|
|
19516
19639
|
cancel: reason => upstream.cancel(reason),
|
|
19517
19640
|
});
|
|
19518
19641
|
}
|
|
19519
|
-
|
|
19520
|
-
[Symbol.asyncIterator]() {
|
|
19642
|
+
[Symbol.asyncIterator](options) {
|
|
19521
19643
|
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
19522
19644
|
if (typeof fn === "function")
|
|
19523
|
-
return fn.call(this);
|
|
19645
|
+
return fn.call(this, options);
|
|
19524
19646
|
const reader = this.getReader();
|
|
19525
|
-
|
|
19647
|
+
const iterator = {
|
|
19526
19648
|
next: async () => {
|
|
19527
19649
|
const r = await reader.read();
|
|
19528
19650
|
if (r.done) {
|
|
@@ -19545,6 +19667,17 @@ class Stream extends ReadableStream {
|
|
|
19545
19667
|
return this;
|
|
19546
19668
|
},
|
|
19547
19669
|
};
|
|
19670
|
+
const asyncDispose = Symbol.asyncDispose;
|
|
19671
|
+
if (asyncDispose) {
|
|
19672
|
+
iterator[asyncDispose] = async () => {
|
|
19673
|
+
var _a;
|
|
19674
|
+
await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
|
|
19675
|
+
};
|
|
19676
|
+
}
|
|
19677
|
+
return iterator;
|
|
19678
|
+
}
|
|
19679
|
+
values(options) {
|
|
19680
|
+
return this[Symbol.asyncIterator](options);
|
|
19548
19681
|
}
|
|
19549
19682
|
}
|
|
19550
19683
|
const CR = 13;
|
|
@@ -19685,7 +19818,16 @@ function match(...matchers) {
|
|
|
19685
19818
|
switch (encoding) {
|
|
19686
19819
|
case "json":
|
|
19687
19820
|
body = await response.text();
|
|
19688
|
-
|
|
19821
|
+
try {
|
|
19822
|
+
raw = JSON.parse(body);
|
|
19823
|
+
}
|
|
19824
|
+
catch (err) {
|
|
19825
|
+
// Passthrough for malformed error bodies; success bodies must be valid.
|
|
19826
|
+
if (!("err" in matcher)) {
|
|
19827
|
+
throw err;
|
|
19828
|
+
}
|
|
19829
|
+
raw = body;
|
|
19830
|
+
}
|
|
19689
19831
|
break;
|
|
19690
19832
|
case "jsonl":
|
|
19691
19833
|
raw = response.body;
|
|
@@ -20043,7 +20185,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
20043
20185
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20044
20186
|
|| client._options.retry_config
|
|
20045
20187
|
|| {
|
|
20046
|
-
strategy: "backoff",
|
|
20188
|
+
strategy: "attempt-count-backoff",
|
|
20047
20189
|
backoff: {
|
|
20048
20190
|
initialInterval: 500,
|
|
20049
20191
|
maxInterval: 8000,
|
|
@@ -20051,6 +20193,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
20051
20193
|
maxElapsedTime: 30000,
|
|
20052
20194
|
},
|
|
20053
20195
|
retryConnectionErrors: true,
|
|
20196
|
+
maxRetries: 4,
|
|
20054
20197
|
}
|
|
20055
20198
|
|| { strategy: "none" },
|
|
20056
20199
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20130,7 +20273,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
20130
20273
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20131
20274
|
|| client._options.retry_config
|
|
20132
20275
|
|| {
|
|
20133
|
-
strategy: "backoff",
|
|
20276
|
+
strategy: "attempt-count-backoff",
|
|
20134
20277
|
backoff: {
|
|
20135
20278
|
initialInterval: 500,
|
|
20136
20279
|
maxInterval: 8000,
|
|
@@ -20138,6 +20281,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
20138
20281
|
maxElapsedTime: 30000,
|
|
20139
20282
|
},
|
|
20140
20283
|
retryConnectionErrors: true,
|
|
20284
|
+
maxRetries: 4,
|
|
20141
20285
|
}
|
|
20142
20286
|
|| { strategy: "none" },
|
|
20143
20287
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20217,7 +20361,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
20217
20361
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20218
20362
|
|| client._options.retry_config
|
|
20219
20363
|
|| {
|
|
20220
|
-
strategy: "backoff",
|
|
20364
|
+
strategy: "attempt-count-backoff",
|
|
20221
20365
|
backoff: {
|
|
20222
20366
|
initialInterval: 500,
|
|
20223
20367
|
maxInterval: 8000,
|
|
@@ -20225,6 +20369,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
20225
20369
|
maxElapsedTime: 30000,
|
|
20226
20370
|
},
|
|
20227
20371
|
retryConnectionErrors: true,
|
|
20372
|
+
maxRetries: 4,
|
|
20228
20373
|
}
|
|
20229
20374
|
|| { strategy: "none" },
|
|
20230
20375
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20307,7 +20452,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
20307
20452
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20308
20453
|
|| client._options.retry_config
|
|
20309
20454
|
|| {
|
|
20310
|
-
strategy: "backoff",
|
|
20455
|
+
strategy: "attempt-count-backoff",
|
|
20311
20456
|
backoff: {
|
|
20312
20457
|
initialInterval: 500,
|
|
20313
20458
|
maxInterval: 8000,
|
|
@@ -20315,6 +20460,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
20315
20460
|
maxElapsedTime: 30000,
|
|
20316
20461
|
},
|
|
20317
20462
|
retryConnectionErrors: true,
|
|
20463
|
+
maxRetries: 4,
|
|
20318
20464
|
}
|
|
20319
20465
|
|| { strategy: "none" },
|
|
20320
20466
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20577,7 +20723,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
20577
20723
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20578
20724
|
|| client._options.retry_config
|
|
20579
20725
|
|| {
|
|
20580
|
-
strategy: "backoff",
|
|
20726
|
+
strategy: "attempt-count-backoff",
|
|
20581
20727
|
backoff: {
|
|
20582
20728
|
initialInterval: 500,
|
|
20583
20729
|
maxInterval: 8000,
|
|
@@ -20585,6 +20731,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
20585
20731
|
maxElapsedTime: 30000,
|
|
20586
20732
|
},
|
|
20587
20733
|
retryConnectionErrors: true,
|
|
20734
|
+
maxRetries: 4,
|
|
20588
20735
|
}
|
|
20589
20736
|
|| { strategy: "none" },
|
|
20590
20737
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20661,7 +20808,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
20661
20808
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20662
20809
|
|| client._options.retry_config
|
|
20663
20810
|
|| {
|
|
20664
|
-
strategy: "backoff",
|
|
20811
|
+
strategy: "attempt-count-backoff",
|
|
20665
20812
|
backoff: {
|
|
20666
20813
|
initialInterval: 500,
|
|
20667
20814
|
maxInterval: 8000,
|
|
@@ -20669,6 +20816,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
20669
20816
|
maxElapsedTime: 30000,
|
|
20670
20817
|
},
|
|
20671
20818
|
retryConnectionErrors: true,
|
|
20819
|
+
maxRetries: 4,
|
|
20672
20820
|
}
|
|
20673
20821
|
|| { strategy: "none" },
|
|
20674
20822
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20757,7 +20905,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
20757
20905
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20758
20906
|
|| client._options.retry_config
|
|
20759
20907
|
|| {
|
|
20760
|
-
strategy: "backoff",
|
|
20908
|
+
strategy: "attempt-count-backoff",
|
|
20761
20909
|
backoff: {
|
|
20762
20910
|
initialInterval: 500,
|
|
20763
20911
|
maxInterval: 8000,
|
|
@@ -20765,6 +20913,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
20765
20913
|
maxElapsedTime: 30000,
|
|
20766
20914
|
},
|
|
20767
20915
|
retryConnectionErrors: true,
|
|
20916
|
+
maxRetries: 4,
|
|
20768
20917
|
}
|
|
20769
20918
|
|| { strategy: "none" },
|
|
20770
20919
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20852,7 +21001,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
20852
21001
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20853
21002
|
|| client._options.retry_config
|
|
20854
21003
|
|| {
|
|
20855
|
-
strategy: "backoff",
|
|
21004
|
+
strategy: "attempt-count-backoff",
|
|
20856
21005
|
backoff: {
|
|
20857
21006
|
initialInterval: 500,
|
|
20858
21007
|
maxInterval: 8000,
|
|
@@ -20860,6 +21009,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
20860
21009
|
maxElapsedTime: 30000,
|
|
20861
21010
|
},
|
|
20862
21011
|
retryConnectionErrors: true,
|
|
21012
|
+
maxRetries: 4,
|
|
20863
21013
|
}
|
|
20864
21014
|
|| { strategy: "none" },
|
|
20865
21015
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20978,7 +21128,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
20978
21128
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20979
21129
|
|| client._options.retry_config
|
|
20980
21130
|
|| {
|
|
20981
|
-
strategy: "backoff",
|
|
21131
|
+
strategy: "attempt-count-backoff",
|
|
20982
21132
|
backoff: {
|
|
20983
21133
|
initialInterval: 500,
|
|
20984
21134
|
maxInterval: 8000,
|
|
@@ -20986,6 +21136,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
20986
21136
|
maxElapsedTime: 30000,
|
|
20987
21137
|
},
|
|
20988
21138
|
retryConnectionErrors: true,
|
|
21139
|
+
maxRetries: 4,
|
|
20989
21140
|
}
|
|
20990
21141
|
|| { strategy: "none" },
|
|
20991
21142
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21065,7 +21216,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
21065
21216
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21066
21217
|
|| client._options.retry_config
|
|
21067
21218
|
|| {
|
|
21068
|
-
strategy: "backoff",
|
|
21219
|
+
strategy: "attempt-count-backoff",
|
|
21069
21220
|
backoff: {
|
|
21070
21221
|
initialInterval: 500,
|
|
21071
21222
|
maxInterval: 8000,
|
|
@@ -21073,6 +21224,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
21073
21224
|
maxElapsedTime: 30000,
|
|
21074
21225
|
},
|
|
21075
21226
|
retryConnectionErrors: true,
|
|
21227
|
+
maxRetries: 4,
|
|
21076
21228
|
}
|
|
21077
21229
|
|| { strategy: "none" },
|
|
21078
21230
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21152,7 +21304,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
21152
21304
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21153
21305
|
|| client._options.retry_config
|
|
21154
21306
|
|| {
|
|
21155
|
-
strategy: "backoff",
|
|
21307
|
+
strategy: "attempt-count-backoff",
|
|
21156
21308
|
backoff: {
|
|
21157
21309
|
initialInterval: 500,
|
|
21158
21310
|
maxInterval: 8000,
|
|
@@ -21160,6 +21312,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
21160
21312
|
maxElapsedTime: 30000,
|
|
21161
21313
|
},
|
|
21162
21314
|
retryConnectionErrors: true,
|
|
21315
|
+
maxRetries: 4,
|
|
21163
21316
|
}
|
|
21164
21317
|
|| { strategy: "none" },
|
|
21165
21318
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21240,7 +21393,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
21240
21393
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21241
21394
|
|| client._options.retry_config
|
|
21242
21395
|
|| {
|
|
21243
|
-
strategy: "backoff",
|
|
21396
|
+
strategy: "attempt-count-backoff",
|
|
21244
21397
|
backoff: {
|
|
21245
21398
|
initialInterval: 500,
|
|
21246
21399
|
maxInterval: 8000,
|
|
@@ -21248,6 +21401,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
21248
21401
|
maxElapsedTime: 30000,
|
|
21249
21402
|
},
|
|
21250
21403
|
retryConnectionErrors: true,
|
|
21404
|
+
maxRetries: 4,
|
|
21251
21405
|
}
|
|
21252
21406
|
|| { strategy: "none" },
|
|
21253
21407
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21330,7 +21484,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
21330
21484
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21331
21485
|
|| client._options.retry_config
|
|
21332
21486
|
|| {
|
|
21333
|
-
strategy: "backoff",
|
|
21487
|
+
strategy: "attempt-count-backoff",
|
|
21334
21488
|
backoff: {
|
|
21335
21489
|
initialInterval: 500,
|
|
21336
21490
|
maxInterval: 8000,
|
|
@@ -21338,6 +21492,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
21338
21492
|
maxElapsedTime: 30000,
|
|
21339
21493
|
},
|
|
21340
21494
|
retryConnectionErrors: true,
|
|
21495
|
+
maxRetries: 4,
|
|
21341
21496
|
}
|
|
21342
21497
|
|| { strategy: "none" },
|
|
21343
21498
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21419,7 +21574,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
21419
21574
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21420
21575
|
|| client._options.retry_config
|
|
21421
21576
|
|| {
|
|
21422
|
-
strategy: "backoff",
|
|
21577
|
+
strategy: "attempt-count-backoff",
|
|
21423
21578
|
backoff: {
|
|
21424
21579
|
initialInterval: 500,
|
|
21425
21580
|
maxInterval: 8000,
|
|
@@ -21427,6 +21582,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
21427
21582
|
maxElapsedTime: 30000,
|
|
21428
21583
|
},
|
|
21429
21584
|
retryConnectionErrors: true,
|
|
21585
|
+
maxRetries: 4,
|
|
21430
21586
|
}
|
|
21431
21587
|
|| { strategy: "none" },
|
|
21432
21588
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21512,7 +21668,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
21512
21668
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21513
21669
|
|| client._options.retry_config
|
|
21514
21670
|
|| {
|
|
21515
|
-
strategy: "backoff",
|
|
21671
|
+
strategy: "attempt-count-backoff",
|
|
21516
21672
|
backoff: {
|
|
21517
21673
|
initialInterval: 500,
|
|
21518
21674
|
maxInterval: 8000,
|
|
@@ -21520,6 +21676,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
21520
21676
|
maxElapsedTime: 30000,
|
|
21521
21677
|
},
|
|
21522
21678
|
retryConnectionErrors: true,
|
|
21679
|
+
maxRetries: 4,
|
|
21523
21680
|
}
|
|
21524
21681
|
|| { strategy: "none" },
|
|
21525
21682
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21786,7 +21943,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
21786
21943
|
if (!options && !streaming) {
|
|
21787
21944
|
return undefined;
|
|
21788
21945
|
}
|
|
21789
|
-
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries
|
|
21946
|
+
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
|
|
21790
21947
|
const nextOptions = Object.assign({}, rest);
|
|
21791
21948
|
if (isPlainObject(query)) {
|
|
21792
21949
|
nextOptions.extra_query = query;
|
|
@@ -21812,6 +21969,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
21812
21969
|
if (timeout_ms !== undefined) {
|
|
21813
21970
|
nextOptions.timeout_ms = timeout_ms;
|
|
21814
21971
|
}
|
|
21972
|
+
if (maxRetries !== undefined) {
|
|
21973
|
+
nextOptions.retries = {
|
|
21974
|
+
strategy: "attempt-count-backoff",
|
|
21975
|
+
retryConnectionErrors: true,
|
|
21976
|
+
maxRetries,
|
|
21977
|
+
};
|
|
21978
|
+
}
|
|
21815
21979
|
if (streaming) {
|
|
21816
21980
|
const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
|
|
21817
21981
|
headers.set("Accept", "text/event-stream");
|
|
@@ -24051,7 +24215,6 @@ class GoogleGenAI {
|
|
|
24051
24215
|
if (this._interactions !== undefined) {
|
|
24052
24216
|
return this._interactions;
|
|
24053
24217
|
}
|
|
24054
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
24055
24218
|
this._interactions = new GeminiNextGenInteractions(this.apiClient);
|
|
24056
24219
|
return this._interactions;
|
|
24057
24220
|
}
|
|
@@ -24118,5 +24281,5 @@ class GoogleGenAI {
|
|
|
24118
24281
|
}
|
|
24119
24282
|
}
|
|
24120
24283
|
|
|
24121
|
-
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 };
|
|
24284
|
+
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 };
|
|
24122
24285
|
//# sourceMappingURL=index.mjs.map
|