@google/genai 2.9.0-rc.0 → 2.9.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 +355 -344
- package/dist/index.cjs +150 -92
- package/dist/index.mjs +150 -92
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +150 -92
- package/dist/node/index.mjs +150 -92
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +355 -344
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +1 -1
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +24 -3
- package/dist/vertex_internal/index.js +1 -1
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +150 -92
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +355 -344
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -7981,6 +7981,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
|
|
|
7981
7981
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
7982
7982
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
7983
7983
|
}
|
|
7984
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
7985
|
+
if (fromLanguageAuto != null) {
|
|
7986
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
7987
|
+
}
|
|
7988
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
7989
|
+
'languageHints',
|
|
7990
|
+
]);
|
|
7991
|
+
if (fromLanguageHints != null) {
|
|
7992
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
7993
|
+
}
|
|
7994
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
7995
|
+
'adaptationPhrases',
|
|
7996
|
+
]);
|
|
7997
|
+
if (fromAdaptationPhrases != null) {
|
|
7998
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
7999
|
+
}
|
|
7984
8000
|
return toObject;
|
|
7985
8001
|
}
|
|
7986
8002
|
function authConfigToMldev$2(fromObject) {
|
|
@@ -9161,6 +9177,10 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
9161
9177
|
if (fromVoiceActivityType != null) {
|
|
9162
9178
|
setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
|
|
9163
9179
|
}
|
|
9180
|
+
const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
|
|
9181
|
+
if (fromAudioOffset != null) {
|
|
9182
|
+
setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
|
|
9183
|
+
}
|
|
9164
9184
|
return toObject;
|
|
9165
9185
|
}
|
|
9166
9186
|
|
|
@@ -13040,7 +13060,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
13040
13060
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
13041
13061
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
13042
13062
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
13043
|
-
const SDK_VERSION = '2.9.0
|
|
13063
|
+
const SDK_VERSION = '2.9.0'; // x-release-please-version
|
|
13044
13064
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
13045
13065
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
13046
13066
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16394,6 +16414,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
|
|
|
16394
16414
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
16395
16415
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
16396
16416
|
}
|
|
16417
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
16418
|
+
if (fromLanguageAuto != null) {
|
|
16419
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
16420
|
+
}
|
|
16421
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
16422
|
+
'languageHints',
|
|
16423
|
+
]);
|
|
16424
|
+
if (fromLanguageHints != null) {
|
|
16425
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
16426
|
+
}
|
|
16427
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
16428
|
+
'adaptationPhrases',
|
|
16429
|
+
]);
|
|
16430
|
+
if (fromAdaptationPhrases != null) {
|
|
16431
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
16432
|
+
}
|
|
16397
16433
|
return toObject;
|
|
16398
16434
|
}
|
|
16399
16435
|
function authConfigToMldev(fromObject) {
|
|
@@ -18000,15 +18036,6 @@ class GoogleGenAiError extends Error {
|
|
|
18000
18036
|
* g3-prettier-ignore-file
|
|
18001
18037
|
*/
|
|
18002
18038
|
class GeminiNextGenAPIClientError extends Error {
|
|
18003
|
-
static [Symbol.hasInstance](instance) {
|
|
18004
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
18005
|
-
return true;
|
|
18006
|
-
}
|
|
18007
|
-
if (this === GeminiNextGenAPIClientError) {
|
|
18008
|
-
return isKnownLegacyErrorLike(instance);
|
|
18009
|
-
}
|
|
18010
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
18011
|
-
}
|
|
18012
18039
|
}
|
|
18013
18040
|
/** General errors raised by the GenAI API. */
|
|
18014
18041
|
class APIError extends GeminiNextGenAPIClientError {
|
|
@@ -18023,6 +18050,7 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
18023
18050
|
this.rawResponse = undefined;
|
|
18024
18051
|
this.cause = undefined;
|
|
18025
18052
|
this.name = this.constructor.name;
|
|
18053
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
18026
18054
|
}
|
|
18027
18055
|
static makeMessage(status, error, message) {
|
|
18028
18056
|
var _a;
|
|
@@ -18034,15 +18062,6 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
18034
18062
|
const statusText = status ? `${status} ` : "";
|
|
18035
18063
|
return `${statusText}${msg}`;
|
|
18036
18064
|
}
|
|
18037
|
-
static [Symbol.hasInstance](instance) {
|
|
18038
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
18039
|
-
return true;
|
|
18040
|
-
}
|
|
18041
|
-
if (this === APIError) {
|
|
18042
|
-
return isAPIErrorLike(instance);
|
|
18043
|
-
}
|
|
18044
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
18045
|
-
}
|
|
18046
18065
|
static generate(status, errorResponse, message, headers) {
|
|
18047
18066
|
if (!status || !headers) {
|
|
18048
18067
|
return new APIConnectionError({
|
|
@@ -18183,57 +18202,12 @@ function stringifyErrorBody(error) {
|
|
|
18183
18202
|
function isPlainObject$2(value) {
|
|
18184
18203
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
18185
18204
|
}
|
|
18186
|
-
function isLegacyErrorLike(value) {
|
|
18187
|
-
if (!(value instanceof Error) || !isPlainObject$2(value)) {
|
|
18188
|
-
return false;
|
|
18189
|
-
}
|
|
18190
|
-
return ("status" in value ||
|
|
18191
|
-
"statusCode" in value ||
|
|
18192
|
-
"error" in value ||
|
|
18193
|
-
"headers" in value);
|
|
18194
|
-
}
|
|
18195
|
-
function isAPIErrorLike(value) {
|
|
18196
|
-
return isLegacyErrorLike(value) && "error" in value;
|
|
18197
|
-
}
|
|
18198
18205
|
function isCompatAPIErrorInstance(value) {
|
|
18206
|
+
// Avoid instanceof here so this guard never depends on Symbol.hasInstance.
|
|
18199
18207
|
return typeof value === "object" && value !== null
|
|
18200
18208
|
? APIError.prototype.isPrototypeOf(value)
|
|
18201
18209
|
: false;
|
|
18202
18210
|
}
|
|
18203
|
-
const knownLegacyErrorNames = [
|
|
18204
|
-
"GeminiNextGenAPIClientError",
|
|
18205
|
-
"APIError",
|
|
18206
|
-
"APIUserAbortError",
|
|
18207
|
-
"APIConnectionError",
|
|
18208
|
-
"APIConnectionTimeoutError",
|
|
18209
|
-
"BadRequestError",
|
|
18210
|
-
"AuthenticationError",
|
|
18211
|
-
"PermissionDeniedError",
|
|
18212
|
-
"NotFoundError",
|
|
18213
|
-
"ConflictError",
|
|
18214
|
-
"UnprocessableEntityError",
|
|
18215
|
-
"RateLimitError",
|
|
18216
|
-
"InternalServerError",
|
|
18217
|
-
];
|
|
18218
|
-
const legacySubclassNamesByBaseName = {
|
|
18219
|
-
GeminiNextGenAPIClientError: knownLegacyErrorNames,
|
|
18220
|
-
APIConnectionError: ["APIConnectionTimeoutError"],
|
|
18221
|
-
};
|
|
18222
|
-
function isKnownLegacyErrorLike(value) {
|
|
18223
|
-
if (!isLegacyErrorLike(value)) {
|
|
18224
|
-
return false;
|
|
18225
|
-
}
|
|
18226
|
-
return knownLegacyErrorNames.includes(value.name);
|
|
18227
|
-
}
|
|
18228
|
-
function isNamedLegacyErrorLike(value, name) {
|
|
18229
|
-
var _a, _b;
|
|
18230
|
-
if (!isLegacyErrorLike(value)) {
|
|
18231
|
-
return false;
|
|
18232
|
-
}
|
|
18233
|
-
const valueName = value.name;
|
|
18234
|
-
return (valueName === name ||
|
|
18235
|
-
((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
|
|
18236
|
-
}
|
|
18237
18211
|
function defineReadonly(target, key, value) {
|
|
18238
18212
|
Object.defineProperty(target, key, {
|
|
18239
18213
|
configurable: true,
|
|
@@ -18443,7 +18417,7 @@ function serverURLFromOptions(options) {
|
|
|
18443
18417
|
return new URL(u);
|
|
18444
18418
|
}
|
|
18445
18419
|
const SDK_METADATA = {
|
|
18446
|
-
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.
|
|
18420
|
+
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
|
|
18447
18421
|
};
|
|
18448
18422
|
|
|
18449
18423
|
/**
|
|
@@ -18992,14 +18966,19 @@ async function retry(fetchFn, options) {
|
|
|
18992
18966
|
statusCodes: options.statusCodes,
|
|
18993
18967
|
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
18994
18968
|
}), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
|
|
18969
|
+
case "attempt-count-backoff":
|
|
18970
|
+
return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
|
|
18971
|
+
statusCodes: options.statusCodes,
|
|
18972
|
+
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
18973
|
+
}), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
|
|
18995
18974
|
default:
|
|
18996
|
-
return await fetchFn();
|
|
18975
|
+
return await fetchFn(0);
|
|
18997
18976
|
}
|
|
18998
18977
|
}
|
|
18999
18978
|
function wrapFetcher(fn, options) {
|
|
19000
|
-
return async () => {
|
|
18979
|
+
return async (attempt) => {
|
|
19001
18980
|
try {
|
|
19002
|
-
const res = await fn();
|
|
18981
|
+
const res = await fn(attempt);
|
|
19003
18982
|
if (isRetryableResponse(res, options.statusCodes)) {
|
|
19004
18983
|
throw new TemporaryError("Response failed with retryable status code", res);
|
|
19005
18984
|
}
|
|
@@ -19041,7 +19020,7 @@ async function retryBackoff(fn, strategy) {
|
|
|
19041
19020
|
let x = 0;
|
|
19042
19021
|
while (true) {
|
|
19043
19022
|
try {
|
|
19044
|
-
const res = await fn();
|
|
19023
|
+
const res = await fn(x);
|
|
19045
19024
|
return res;
|
|
19046
19025
|
}
|
|
19047
19026
|
catch (err) {
|
|
@@ -19069,7 +19048,46 @@ async function retryBackoff(fn, strategy) {
|
|
|
19069
19048
|
}
|
|
19070
19049
|
}
|
|
19071
19050
|
}
|
|
19051
|
+
async function retryAttemptCountBackoff(fn, strategy, config) {
|
|
19052
|
+
let attempt = 0;
|
|
19053
|
+
while (true) {
|
|
19054
|
+
try {
|
|
19055
|
+
return await fn(attempt);
|
|
19056
|
+
}
|
|
19057
|
+
catch (err) {
|
|
19058
|
+
if (err instanceof PermanentError) {
|
|
19059
|
+
throw err.cause;
|
|
19060
|
+
}
|
|
19061
|
+
if (attempt >= config.maxRetries) {
|
|
19062
|
+
if (err instanceof TemporaryError) {
|
|
19063
|
+
return err.response;
|
|
19064
|
+
}
|
|
19065
|
+
throw err;
|
|
19066
|
+
}
|
|
19067
|
+
let retryInterval = 0;
|
|
19068
|
+
if (err instanceof TemporaryError) {
|
|
19069
|
+
retryInterval = retryIntervalFromResponse(err.response);
|
|
19070
|
+
}
|
|
19071
|
+
if (retryInterval <= 0) {
|
|
19072
|
+
retryInterval =
|
|
19073
|
+
strategy.initialInterval *
|
|
19074
|
+
Math.pow(strategy.exponent, attempt) *
|
|
19075
|
+
(1 - Math.random() * 0.25);
|
|
19076
|
+
}
|
|
19077
|
+
const d = Math.min(retryInterval, strategy.maxInterval);
|
|
19078
|
+
await delay(d);
|
|
19079
|
+
attempt++;
|
|
19080
|
+
}
|
|
19081
|
+
}
|
|
19082
|
+
}
|
|
19072
19083
|
function retryIntervalFromResponse(res) {
|
|
19084
|
+
const retryAfterMsVal = res.headers.get("retry-after-ms");
|
|
19085
|
+
if (retryAfterMsVal) {
|
|
19086
|
+
const parsedMs = Number(retryAfterMsVal);
|
|
19087
|
+
if (Number.isFinite(parsedMs) && parsedMs >= 0) {
|
|
19088
|
+
return parsedMs;
|
|
19089
|
+
}
|
|
19090
|
+
}
|
|
19073
19091
|
const retryVal = res.headers.get("retry-after") || "";
|
|
19074
19092
|
if (!retryVal) {
|
|
19075
19093
|
return 0;
|
|
@@ -19524,13 +19542,12 @@ class Stream extends ReadableStream {
|
|
|
19524
19542
|
cancel: reason => upstream.cancel(reason),
|
|
19525
19543
|
});
|
|
19526
19544
|
}
|
|
19527
|
-
|
|
19528
|
-
[Symbol.asyncIterator]() {
|
|
19545
|
+
[Symbol.asyncIterator](options) {
|
|
19529
19546
|
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
19530
19547
|
if (typeof fn === "function")
|
|
19531
|
-
return fn.call(this);
|
|
19548
|
+
return fn.call(this, options);
|
|
19532
19549
|
const reader = this.getReader();
|
|
19533
|
-
|
|
19550
|
+
const iterator = {
|
|
19534
19551
|
next: async () => {
|
|
19535
19552
|
const r = await reader.read();
|
|
19536
19553
|
if (r.done) {
|
|
@@ -19553,6 +19570,17 @@ class Stream extends ReadableStream {
|
|
|
19553
19570
|
return this;
|
|
19554
19571
|
},
|
|
19555
19572
|
};
|
|
19573
|
+
const asyncDispose = Symbol.asyncDispose;
|
|
19574
|
+
if (asyncDispose) {
|
|
19575
|
+
iterator[asyncDispose] = async () => {
|
|
19576
|
+
var _a;
|
|
19577
|
+
await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
|
|
19578
|
+
};
|
|
19579
|
+
}
|
|
19580
|
+
return iterator;
|
|
19581
|
+
}
|
|
19582
|
+
values(options) {
|
|
19583
|
+
return this[Symbol.asyncIterator](options);
|
|
19556
19584
|
}
|
|
19557
19585
|
}
|
|
19558
19586
|
const CR = 13;
|
|
@@ -19693,7 +19721,16 @@ function match(...matchers) {
|
|
|
19693
19721
|
switch (encoding) {
|
|
19694
19722
|
case "json":
|
|
19695
19723
|
body = await response.text();
|
|
19696
|
-
|
|
19724
|
+
try {
|
|
19725
|
+
raw = JSON.parse(body);
|
|
19726
|
+
}
|
|
19727
|
+
catch (err) {
|
|
19728
|
+
// Passthrough for malformed error bodies; success bodies must be valid.
|
|
19729
|
+
if (!("err" in matcher)) {
|
|
19730
|
+
throw err;
|
|
19731
|
+
}
|
|
19732
|
+
raw = body;
|
|
19733
|
+
}
|
|
19697
19734
|
break;
|
|
19698
19735
|
case "jsonl":
|
|
19699
19736
|
raw = response.body;
|
|
@@ -20051,7 +20088,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
20051
20088
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20052
20089
|
|| client._options.retry_config
|
|
20053
20090
|
|| {
|
|
20054
|
-
strategy: "backoff",
|
|
20091
|
+
strategy: "attempt-count-backoff",
|
|
20055
20092
|
backoff: {
|
|
20056
20093
|
initialInterval: 500,
|
|
20057
20094
|
maxInterval: 8000,
|
|
@@ -20059,6 +20096,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
20059
20096
|
maxElapsedTime: 30000,
|
|
20060
20097
|
},
|
|
20061
20098
|
retryConnectionErrors: true,
|
|
20099
|
+
maxRetries: 4,
|
|
20062
20100
|
}
|
|
20063
20101
|
|| { strategy: "none" },
|
|
20064
20102
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20138,7 +20176,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
20138
20176
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20139
20177
|
|| client._options.retry_config
|
|
20140
20178
|
|| {
|
|
20141
|
-
strategy: "backoff",
|
|
20179
|
+
strategy: "attempt-count-backoff",
|
|
20142
20180
|
backoff: {
|
|
20143
20181
|
initialInterval: 500,
|
|
20144
20182
|
maxInterval: 8000,
|
|
@@ -20146,6 +20184,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
20146
20184
|
maxElapsedTime: 30000,
|
|
20147
20185
|
},
|
|
20148
20186
|
retryConnectionErrors: true,
|
|
20187
|
+
maxRetries: 4,
|
|
20149
20188
|
}
|
|
20150
20189
|
|| { strategy: "none" },
|
|
20151
20190
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20225,7 +20264,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
20225
20264
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20226
20265
|
|| client._options.retry_config
|
|
20227
20266
|
|| {
|
|
20228
|
-
strategy: "backoff",
|
|
20267
|
+
strategy: "attempt-count-backoff",
|
|
20229
20268
|
backoff: {
|
|
20230
20269
|
initialInterval: 500,
|
|
20231
20270
|
maxInterval: 8000,
|
|
@@ -20233,6 +20272,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
20233
20272
|
maxElapsedTime: 30000,
|
|
20234
20273
|
},
|
|
20235
20274
|
retryConnectionErrors: true,
|
|
20275
|
+
maxRetries: 4,
|
|
20236
20276
|
}
|
|
20237
20277
|
|| { strategy: "none" },
|
|
20238
20278
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20315,7 +20355,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
20315
20355
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20316
20356
|
|| client._options.retry_config
|
|
20317
20357
|
|| {
|
|
20318
|
-
strategy: "backoff",
|
|
20358
|
+
strategy: "attempt-count-backoff",
|
|
20319
20359
|
backoff: {
|
|
20320
20360
|
initialInterval: 500,
|
|
20321
20361
|
maxInterval: 8000,
|
|
@@ -20323,6 +20363,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
20323
20363
|
maxElapsedTime: 30000,
|
|
20324
20364
|
},
|
|
20325
20365
|
retryConnectionErrors: true,
|
|
20366
|
+
maxRetries: 4,
|
|
20326
20367
|
}
|
|
20327
20368
|
|| { strategy: "none" },
|
|
20328
20369
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20585,7 +20626,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
20585
20626
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20586
20627
|
|| client._options.retry_config
|
|
20587
20628
|
|| {
|
|
20588
|
-
strategy: "backoff",
|
|
20629
|
+
strategy: "attempt-count-backoff",
|
|
20589
20630
|
backoff: {
|
|
20590
20631
|
initialInterval: 500,
|
|
20591
20632
|
maxInterval: 8000,
|
|
@@ -20593,6 +20634,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
20593
20634
|
maxElapsedTime: 30000,
|
|
20594
20635
|
},
|
|
20595
20636
|
retryConnectionErrors: true,
|
|
20637
|
+
maxRetries: 4,
|
|
20596
20638
|
}
|
|
20597
20639
|
|| { strategy: "none" },
|
|
20598
20640
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20669,7 +20711,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
20669
20711
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20670
20712
|
|| client._options.retry_config
|
|
20671
20713
|
|| {
|
|
20672
|
-
strategy: "backoff",
|
|
20714
|
+
strategy: "attempt-count-backoff",
|
|
20673
20715
|
backoff: {
|
|
20674
20716
|
initialInterval: 500,
|
|
20675
20717
|
maxInterval: 8000,
|
|
@@ -20677,6 +20719,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
20677
20719
|
maxElapsedTime: 30000,
|
|
20678
20720
|
},
|
|
20679
20721
|
retryConnectionErrors: true,
|
|
20722
|
+
maxRetries: 4,
|
|
20680
20723
|
}
|
|
20681
20724
|
|| { strategy: "none" },
|
|
20682
20725
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20765,7 +20808,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
20765
20808
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20766
20809
|
|| client._options.retry_config
|
|
20767
20810
|
|| {
|
|
20768
|
-
strategy: "backoff",
|
|
20811
|
+
strategy: "attempt-count-backoff",
|
|
20769
20812
|
backoff: {
|
|
20770
20813
|
initialInterval: 500,
|
|
20771
20814
|
maxInterval: 8000,
|
|
@@ -20773,6 +20816,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
20773
20816
|
maxElapsedTime: 30000,
|
|
20774
20817
|
},
|
|
20775
20818
|
retryConnectionErrors: true,
|
|
20819
|
+
maxRetries: 4,
|
|
20776
20820
|
}
|
|
20777
20821
|
|| { strategy: "none" },
|
|
20778
20822
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20860,7 +20904,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
20860
20904
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20861
20905
|
|| client._options.retry_config
|
|
20862
20906
|
|| {
|
|
20863
|
-
strategy: "backoff",
|
|
20907
|
+
strategy: "attempt-count-backoff",
|
|
20864
20908
|
backoff: {
|
|
20865
20909
|
initialInterval: 500,
|
|
20866
20910
|
maxInterval: 8000,
|
|
@@ -20868,6 +20912,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
20868
20912
|
maxElapsedTime: 30000,
|
|
20869
20913
|
},
|
|
20870
20914
|
retryConnectionErrors: true,
|
|
20915
|
+
maxRetries: 4,
|
|
20871
20916
|
}
|
|
20872
20917
|
|| { strategy: "none" },
|
|
20873
20918
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -20986,7 +21031,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
20986
21031
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
20987
21032
|
|| client._options.retry_config
|
|
20988
21033
|
|| {
|
|
20989
|
-
strategy: "backoff",
|
|
21034
|
+
strategy: "attempt-count-backoff",
|
|
20990
21035
|
backoff: {
|
|
20991
21036
|
initialInterval: 500,
|
|
20992
21037
|
maxInterval: 8000,
|
|
@@ -20994,6 +21039,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
20994
21039
|
maxElapsedTime: 30000,
|
|
20995
21040
|
},
|
|
20996
21041
|
retryConnectionErrors: true,
|
|
21042
|
+
maxRetries: 4,
|
|
20997
21043
|
}
|
|
20998
21044
|
|| { strategy: "none" },
|
|
20999
21045
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21073,7 +21119,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
21073
21119
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21074
21120
|
|| client._options.retry_config
|
|
21075
21121
|
|| {
|
|
21076
|
-
strategy: "backoff",
|
|
21122
|
+
strategy: "attempt-count-backoff",
|
|
21077
21123
|
backoff: {
|
|
21078
21124
|
initialInterval: 500,
|
|
21079
21125
|
maxInterval: 8000,
|
|
@@ -21081,6 +21127,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
21081
21127
|
maxElapsedTime: 30000,
|
|
21082
21128
|
},
|
|
21083
21129
|
retryConnectionErrors: true,
|
|
21130
|
+
maxRetries: 4,
|
|
21084
21131
|
}
|
|
21085
21132
|
|| { strategy: "none" },
|
|
21086
21133
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21160,7 +21207,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
21160
21207
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21161
21208
|
|| client._options.retry_config
|
|
21162
21209
|
|| {
|
|
21163
|
-
strategy: "backoff",
|
|
21210
|
+
strategy: "attempt-count-backoff",
|
|
21164
21211
|
backoff: {
|
|
21165
21212
|
initialInterval: 500,
|
|
21166
21213
|
maxInterval: 8000,
|
|
@@ -21168,6 +21215,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
21168
21215
|
maxElapsedTime: 30000,
|
|
21169
21216
|
},
|
|
21170
21217
|
retryConnectionErrors: true,
|
|
21218
|
+
maxRetries: 4,
|
|
21171
21219
|
}
|
|
21172
21220
|
|| { strategy: "none" },
|
|
21173
21221
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21248,7 +21296,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
21248
21296
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21249
21297
|
|| client._options.retry_config
|
|
21250
21298
|
|| {
|
|
21251
|
-
strategy: "backoff",
|
|
21299
|
+
strategy: "attempt-count-backoff",
|
|
21252
21300
|
backoff: {
|
|
21253
21301
|
initialInterval: 500,
|
|
21254
21302
|
maxInterval: 8000,
|
|
@@ -21256,6 +21304,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
21256
21304
|
maxElapsedTime: 30000,
|
|
21257
21305
|
},
|
|
21258
21306
|
retryConnectionErrors: true,
|
|
21307
|
+
maxRetries: 4,
|
|
21259
21308
|
}
|
|
21260
21309
|
|| { strategy: "none" },
|
|
21261
21310
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21338,7 +21387,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
21338
21387
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21339
21388
|
|| client._options.retry_config
|
|
21340
21389
|
|| {
|
|
21341
|
-
strategy: "backoff",
|
|
21390
|
+
strategy: "attempt-count-backoff",
|
|
21342
21391
|
backoff: {
|
|
21343
21392
|
initialInterval: 500,
|
|
21344
21393
|
maxInterval: 8000,
|
|
@@ -21346,6 +21395,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
21346
21395
|
maxElapsedTime: 30000,
|
|
21347
21396
|
},
|
|
21348
21397
|
retryConnectionErrors: true,
|
|
21398
|
+
maxRetries: 4,
|
|
21349
21399
|
}
|
|
21350
21400
|
|| { strategy: "none" },
|
|
21351
21401
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21427,7 +21477,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
21427
21477
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21428
21478
|
|| client._options.retry_config
|
|
21429
21479
|
|| {
|
|
21430
|
-
strategy: "backoff",
|
|
21480
|
+
strategy: "attempt-count-backoff",
|
|
21431
21481
|
backoff: {
|
|
21432
21482
|
initialInterval: 500,
|
|
21433
21483
|
maxInterval: 8000,
|
|
@@ -21435,6 +21485,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
21435
21485
|
maxElapsedTime: 30000,
|
|
21436
21486
|
},
|
|
21437
21487
|
retryConnectionErrors: true,
|
|
21488
|
+
maxRetries: 4,
|
|
21438
21489
|
}
|
|
21439
21490
|
|| { strategy: "none" },
|
|
21440
21491
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21520,7 +21571,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
21520
21571
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
21521
21572
|
|| client._options.retry_config
|
|
21522
21573
|
|| {
|
|
21523
|
-
strategy: "backoff",
|
|
21574
|
+
strategy: "attempt-count-backoff",
|
|
21524
21575
|
backoff: {
|
|
21525
21576
|
initialInterval: 500,
|
|
21526
21577
|
maxInterval: 8000,
|
|
@@ -21528,6 +21579,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
21528
21579
|
maxElapsedTime: 30000,
|
|
21529
21580
|
},
|
|
21530
21581
|
retryConnectionErrors: true,
|
|
21582
|
+
maxRetries: 4,
|
|
21531
21583
|
}
|
|
21532
21584
|
|| { strategy: "none" },
|
|
21533
21585
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -21794,7 +21846,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
21794
21846
|
if (!options && !streaming) {
|
|
21795
21847
|
return undefined;
|
|
21796
21848
|
}
|
|
21797
|
-
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries
|
|
21849
|
+
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
|
|
21798
21850
|
const nextOptions = Object.assign({}, rest);
|
|
21799
21851
|
if (isPlainObject(query)) {
|
|
21800
21852
|
nextOptions.extra_query = query;
|
|
@@ -21820,6 +21872,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
21820
21872
|
if (timeout_ms !== undefined) {
|
|
21821
21873
|
nextOptions.timeout_ms = timeout_ms;
|
|
21822
21874
|
}
|
|
21875
|
+
if (maxRetries !== undefined) {
|
|
21876
|
+
nextOptions.retries = {
|
|
21877
|
+
strategy: "attempt-count-backoff",
|
|
21878
|
+
retryConnectionErrors: true,
|
|
21879
|
+
maxRetries,
|
|
21880
|
+
};
|
|
21881
|
+
}
|
|
21823
21882
|
if (streaming) {
|
|
21824
21883
|
const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
|
|
21825
21884
|
headers.set("Accept", "text/event-stream");
|
|
@@ -24431,7 +24490,6 @@ class GoogleGenAI {
|
|
|
24431
24490
|
if (this._interactions !== undefined) {
|
|
24432
24491
|
return this._interactions;
|
|
24433
24492
|
}
|
|
24434
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
24435
24493
|
this._interactions = new GeminiNextGenInteractions(this.apiClient);
|
|
24436
24494
|
return this._interactions;
|
|
24437
24495
|
}
|