@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.
@@ -7973,6 +7973,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
7973
7973
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
7974
7974
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
7975
7975
  }
7976
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
7977
+ if (fromLanguageAuto != null) {
7978
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
7979
+ }
7980
+ const fromLanguageHints = getValueByPath(fromObject, [
7981
+ 'languageHints',
7982
+ ]);
7983
+ if (fromLanguageHints != null) {
7984
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
7985
+ }
7986
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
7987
+ 'adaptationPhrases',
7988
+ ]);
7989
+ if (fromAdaptationPhrases != null) {
7990
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
7991
+ }
7976
7992
  return toObject;
7977
7993
  }
7978
7994
  function authConfigToMldev$2(fromObject) {
@@ -9153,6 +9169,10 @@ function voiceActivityFromVertex(fromObject) {
9153
9169
  if (fromVoiceActivityType != null) {
9154
9170
  setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
9155
9171
  }
9172
+ const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
9173
+ if (fromAudioOffset != null) {
9174
+ setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
9175
+ }
9156
9176
  return toObject;
9157
9177
  }
9158
9178
 
@@ -13032,7 +13052,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13032
13052
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13033
13053
  const USER_AGENT_HEADER = 'User-Agent';
13034
13054
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13035
- const SDK_VERSION = '2.9.0-rc.0'; // x-release-please-version
13055
+ const SDK_VERSION = '2.9.0'; // x-release-please-version
13036
13056
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13037
13057
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13038
13058
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -16386,6 +16406,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
16386
16406
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
16387
16407
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16388
16408
  }
16409
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
16410
+ if (fromLanguageAuto != null) {
16411
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
16412
+ }
16413
+ const fromLanguageHints = getValueByPath(fromObject, [
16414
+ 'languageHints',
16415
+ ]);
16416
+ if (fromLanguageHints != null) {
16417
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
16418
+ }
16419
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
16420
+ 'adaptationPhrases',
16421
+ ]);
16422
+ if (fromAdaptationPhrases != null) {
16423
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
16424
+ }
16389
16425
  return toObject;
16390
16426
  }
16391
16427
  function authConfigToMldev(fromObject) {
@@ -17992,15 +18028,6 @@ class GoogleGenAiError extends Error {
17992
18028
  * g3-prettier-ignore-file
17993
18029
  */
17994
18030
  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
18031
  }
18005
18032
  /** General errors raised by the GenAI API. */
18006
18033
  class APIError extends GeminiNextGenAPIClientError {
@@ -18015,6 +18042,7 @@ class APIError extends GeminiNextGenAPIClientError {
18015
18042
  this.rawResponse = undefined;
18016
18043
  this.cause = undefined;
18017
18044
  this.name = this.constructor.name;
18045
+ Object.setPrototypeOf(this, new.target.prototype);
18018
18046
  }
18019
18047
  static makeMessage(status, error, message) {
18020
18048
  var _a;
@@ -18026,15 +18054,6 @@ class APIError extends GeminiNextGenAPIClientError {
18026
18054
  const statusText = status ? `${status} ` : "";
18027
18055
  return `${statusText}${msg}`;
18028
18056
  }
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
18057
  static generate(status, errorResponse, message, headers) {
18039
18058
  if (!status || !headers) {
18040
18059
  return new APIConnectionError({
@@ -18175,57 +18194,12 @@ function stringifyErrorBody(error) {
18175
18194
  function isPlainObject$2(value) {
18176
18195
  return value !== null && typeof value === "object" && !Array.isArray(value);
18177
18196
  }
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
18197
  function isCompatAPIErrorInstance(value) {
18198
+ // Avoid instanceof here so this guard never depends on Symbol.hasInstance.
18191
18199
  return typeof value === "object" && value !== null
18192
18200
  ? APIError.prototype.isPrototypeOf(value)
18193
18201
  : false;
18194
18202
  }
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
18203
  function defineReadonly(target, key, value) {
18230
18204
  Object.defineProperty(target, key, {
18231
18205
  configurable: true,
@@ -18435,7 +18409,7 @@ function serverURLFromOptions(options) {
18435
18409
  return new URL(u);
18436
18410
  }
18437
18411
  const SDK_METADATA = {
18438
- userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.904.2 v1beta @google/genai",
18412
+ userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
18439
18413
  };
18440
18414
 
18441
18415
  /**
@@ -18984,14 +18958,19 @@ async function retry(fetchFn, options) {
18984
18958
  statusCodes: options.statusCodes,
18985
18959
  retryConnectionErrors: !!options.config.retryConnectionErrors,
18986
18960
  }), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
18961
+ case "attempt-count-backoff":
18962
+ return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
18963
+ statusCodes: options.statusCodes,
18964
+ retryConnectionErrors: !!options.config.retryConnectionErrors,
18965
+ }), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
18987
18966
  default:
18988
- return await fetchFn();
18967
+ return await fetchFn(0);
18989
18968
  }
18990
18969
  }
18991
18970
  function wrapFetcher(fn, options) {
18992
- return async () => {
18971
+ return async (attempt) => {
18993
18972
  try {
18994
- const res = await fn();
18973
+ const res = await fn(attempt);
18995
18974
  if (isRetryableResponse(res, options.statusCodes)) {
18996
18975
  throw new TemporaryError("Response failed with retryable status code", res);
18997
18976
  }
@@ -19033,7 +19012,7 @@ async function retryBackoff(fn, strategy) {
19033
19012
  let x = 0;
19034
19013
  while (true) {
19035
19014
  try {
19036
- const res = await fn();
19015
+ const res = await fn(x);
19037
19016
  return res;
19038
19017
  }
19039
19018
  catch (err) {
@@ -19061,7 +19040,46 @@ async function retryBackoff(fn, strategy) {
19061
19040
  }
19062
19041
  }
19063
19042
  }
19043
+ async function retryAttemptCountBackoff(fn, strategy, config) {
19044
+ let attempt = 0;
19045
+ while (true) {
19046
+ try {
19047
+ return await fn(attempt);
19048
+ }
19049
+ catch (err) {
19050
+ if (err instanceof PermanentError) {
19051
+ throw err.cause;
19052
+ }
19053
+ if (attempt >= config.maxRetries) {
19054
+ if (err instanceof TemporaryError) {
19055
+ return err.response;
19056
+ }
19057
+ throw err;
19058
+ }
19059
+ let retryInterval = 0;
19060
+ if (err instanceof TemporaryError) {
19061
+ retryInterval = retryIntervalFromResponse(err.response);
19062
+ }
19063
+ if (retryInterval <= 0) {
19064
+ retryInterval =
19065
+ strategy.initialInterval *
19066
+ Math.pow(strategy.exponent, attempt) *
19067
+ (1 - Math.random() * 0.25);
19068
+ }
19069
+ const d = Math.min(retryInterval, strategy.maxInterval);
19070
+ await delay(d);
19071
+ attempt++;
19072
+ }
19073
+ }
19074
+ }
19064
19075
  function retryIntervalFromResponse(res) {
19076
+ const retryAfterMsVal = res.headers.get("retry-after-ms");
19077
+ if (retryAfterMsVal) {
19078
+ const parsedMs = Number(retryAfterMsVal);
19079
+ if (Number.isFinite(parsedMs) && parsedMs >= 0) {
19080
+ return parsedMs;
19081
+ }
19082
+ }
19065
19083
  const retryVal = res.headers.get("retry-after") || "";
19066
19084
  if (!retryVal) {
19067
19085
  return 0;
@@ -19516,13 +19534,12 @@ class Stream extends ReadableStream {
19516
19534
  cancel: reason => upstream.cancel(reason),
19517
19535
  });
19518
19536
  }
19519
- // Polyfill for older browsers
19520
- [Symbol.asyncIterator]() {
19537
+ [Symbol.asyncIterator](options) {
19521
19538
  const fn = ReadableStream.prototype[Symbol.asyncIterator];
19522
19539
  if (typeof fn === "function")
19523
- return fn.call(this);
19540
+ return fn.call(this, options);
19524
19541
  const reader = this.getReader();
19525
- return {
19542
+ const iterator = {
19526
19543
  next: async () => {
19527
19544
  const r = await reader.read();
19528
19545
  if (r.done) {
@@ -19545,6 +19562,17 @@ class Stream extends ReadableStream {
19545
19562
  return this;
19546
19563
  },
19547
19564
  };
19565
+ const asyncDispose = Symbol.asyncDispose;
19566
+ if (asyncDispose) {
19567
+ iterator[asyncDispose] = async () => {
19568
+ var _a;
19569
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
19570
+ };
19571
+ }
19572
+ return iterator;
19573
+ }
19574
+ values(options) {
19575
+ return this[Symbol.asyncIterator](options);
19548
19576
  }
19549
19577
  }
19550
19578
  const CR = 13;
@@ -19685,7 +19713,16 @@ function match(...matchers) {
19685
19713
  switch (encoding) {
19686
19714
  case "json":
19687
19715
  body = await response.text();
19688
- raw = JSON.parse(body);
19716
+ try {
19717
+ raw = JSON.parse(body);
19718
+ }
19719
+ catch (err) {
19720
+ // Passthrough for malformed error bodies; success bodies must be valid.
19721
+ if (!("err" in matcher)) {
19722
+ throw err;
19723
+ }
19724
+ raw = body;
19725
+ }
19689
19726
  break;
19690
19727
  case "jsonl":
19691
19728
  raw = response.body;
@@ -20043,7 +20080,7 @@ async function $do$e(client, body, api_version, options) {
20043
20080
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20044
20081
  || client._options.retry_config
20045
20082
  || {
20046
- strategy: "backoff",
20083
+ strategy: "attempt-count-backoff",
20047
20084
  backoff: {
20048
20085
  initialInterval: 500,
20049
20086
  maxInterval: 8000,
@@ -20051,6 +20088,7 @@ async function $do$e(client, body, api_version, options) {
20051
20088
  maxElapsedTime: 30000,
20052
20089
  },
20053
20090
  retryConnectionErrors: true,
20091
+ maxRetries: 4,
20054
20092
  }
20055
20093
  || { strategy: "none" },
20056
20094
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20130,7 +20168,7 @@ async function $do$d(client, id, api_version, options) {
20130
20168
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20131
20169
  || client._options.retry_config
20132
20170
  || {
20133
- strategy: "backoff",
20171
+ strategy: "attempt-count-backoff",
20134
20172
  backoff: {
20135
20173
  initialInterval: 500,
20136
20174
  maxInterval: 8000,
@@ -20138,6 +20176,7 @@ async function $do$d(client, id, api_version, options) {
20138
20176
  maxElapsedTime: 30000,
20139
20177
  },
20140
20178
  retryConnectionErrors: true,
20179
+ maxRetries: 4,
20141
20180
  }
20142
20181
  || { strategy: "none" },
20143
20182
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20217,7 +20256,7 @@ async function $do$c(client, id, api_version, options) {
20217
20256
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20218
20257
  || client._options.retry_config
20219
20258
  || {
20220
- strategy: "backoff",
20259
+ strategy: "attempt-count-backoff",
20221
20260
  backoff: {
20222
20261
  initialInterval: 500,
20223
20262
  maxInterval: 8000,
@@ -20225,6 +20264,7 @@ async function $do$c(client, id, api_version, options) {
20225
20264
  maxElapsedTime: 30000,
20226
20265
  },
20227
20266
  retryConnectionErrors: true,
20267
+ maxRetries: 4,
20228
20268
  }
20229
20269
  || { strategy: "none" },
20230
20270
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20307,7 +20347,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
20307
20347
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20308
20348
  || client._options.retry_config
20309
20349
  || {
20310
- strategy: "backoff",
20350
+ strategy: "attempt-count-backoff",
20311
20351
  backoff: {
20312
20352
  initialInterval: 500,
20313
20353
  maxInterval: 8000,
@@ -20315,6 +20355,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
20315
20355
  maxElapsedTime: 30000,
20316
20356
  },
20317
20357
  retryConnectionErrors: true,
20358
+ maxRetries: 4,
20318
20359
  }
20319
20360
  || { strategy: "none" },
20320
20361
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20577,7 +20618,7 @@ async function $do$a(client, id, api_version, options) {
20577
20618
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20578
20619
  || client._options.retry_config
20579
20620
  || {
20580
- strategy: "backoff",
20621
+ strategy: "attempt-count-backoff",
20581
20622
  backoff: {
20582
20623
  initialInterval: 500,
20583
20624
  maxInterval: 8000,
@@ -20585,6 +20626,7 @@ async function $do$a(client, id, api_version, options) {
20585
20626
  maxElapsedTime: 30000,
20586
20627
  },
20587
20628
  retryConnectionErrors: true,
20629
+ maxRetries: 4,
20588
20630
  }
20589
20631
  || { strategy: "none" },
20590
20632
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20661,7 +20703,7 @@ async function $do$9(client, body, api_version, options) {
20661
20703
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20662
20704
  || client._options.retry_config
20663
20705
  || {
20664
- strategy: "backoff",
20706
+ strategy: "attempt-count-backoff",
20665
20707
  backoff: {
20666
20708
  initialInterval: 500,
20667
20709
  maxInterval: 8000,
@@ -20669,6 +20711,7 @@ async function $do$9(client, body, api_version, options) {
20669
20711
  maxElapsedTime: 30000,
20670
20712
  },
20671
20713
  retryConnectionErrors: true,
20714
+ maxRetries: 4,
20672
20715
  }
20673
20716
  || { strategy: "none" },
20674
20717
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20757,7 +20800,7 @@ async function $do$8(client, id, api_version, options) {
20757
20800
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20758
20801
  || client._options.retry_config
20759
20802
  || {
20760
- strategy: "backoff",
20803
+ strategy: "attempt-count-backoff",
20761
20804
  backoff: {
20762
20805
  initialInterval: 500,
20763
20806
  maxInterval: 8000,
@@ -20765,6 +20808,7 @@ async function $do$8(client, id, api_version, options) {
20765
20808
  maxElapsedTime: 30000,
20766
20809
  },
20767
20810
  retryConnectionErrors: true,
20811
+ maxRetries: 4,
20768
20812
  }
20769
20813
  || { strategy: "none" },
20770
20814
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20852,7 +20896,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
20852
20896
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20853
20897
  || client._options.retry_config
20854
20898
  || {
20855
- strategy: "backoff",
20899
+ strategy: "attempt-count-backoff",
20856
20900
  backoff: {
20857
20901
  initialInterval: 500,
20858
20902
  maxInterval: 8000,
@@ -20860,6 +20904,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
20860
20904
  maxElapsedTime: 30000,
20861
20905
  },
20862
20906
  retryConnectionErrors: true,
20907
+ maxRetries: 4,
20863
20908
  }
20864
20909
  || { strategy: "none" },
20865
20910
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20978,7 +21023,7 @@ async function $do$6(client, body, api_version, options) {
20978
21023
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20979
21024
  || client._options.retry_config
20980
21025
  || {
20981
- strategy: "backoff",
21026
+ strategy: "attempt-count-backoff",
20982
21027
  backoff: {
20983
21028
  initialInterval: 500,
20984
21029
  maxInterval: 8000,
@@ -20986,6 +21031,7 @@ async function $do$6(client, body, api_version, options) {
20986
21031
  maxElapsedTime: 30000,
20987
21032
  },
20988
21033
  retryConnectionErrors: true,
21034
+ maxRetries: 4,
20989
21035
  }
20990
21036
  || { strategy: "none" },
20991
21037
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21065,7 +21111,7 @@ async function $do$5(client, id, api_version, options) {
21065
21111
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21066
21112
  || client._options.retry_config
21067
21113
  || {
21068
- strategy: "backoff",
21114
+ strategy: "attempt-count-backoff",
21069
21115
  backoff: {
21070
21116
  initialInterval: 500,
21071
21117
  maxInterval: 8000,
@@ -21073,6 +21119,7 @@ async function $do$5(client, id, api_version, options) {
21073
21119
  maxElapsedTime: 30000,
21074
21120
  },
21075
21121
  retryConnectionErrors: true,
21122
+ maxRetries: 4,
21076
21123
  }
21077
21124
  || { strategy: "none" },
21078
21125
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21152,7 +21199,7 @@ async function $do$4(client, id, api_version, options) {
21152
21199
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21153
21200
  || client._options.retry_config
21154
21201
  || {
21155
- strategy: "backoff",
21202
+ strategy: "attempt-count-backoff",
21156
21203
  backoff: {
21157
21204
  initialInterval: 500,
21158
21205
  maxInterval: 8000,
@@ -21160,6 +21207,7 @@ async function $do$4(client, id, api_version, options) {
21160
21207
  maxElapsedTime: 30000,
21161
21208
  },
21162
21209
  retryConnectionErrors: true,
21210
+ maxRetries: 4,
21163
21211
  }
21164
21212
  || { strategy: "none" },
21165
21213
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21240,7 +21288,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
21240
21288
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21241
21289
  || client._options.retry_config
21242
21290
  || {
21243
- strategy: "backoff",
21291
+ strategy: "attempt-count-backoff",
21244
21292
  backoff: {
21245
21293
  initialInterval: 500,
21246
21294
  maxInterval: 8000,
@@ -21248,6 +21296,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
21248
21296
  maxElapsedTime: 30000,
21249
21297
  },
21250
21298
  retryConnectionErrors: true,
21299
+ maxRetries: 4,
21251
21300
  }
21252
21301
  || { strategy: "none" },
21253
21302
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21330,7 +21379,7 @@ async function $do$2(client, id, api_version, body, options) {
21330
21379
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21331
21380
  || client._options.retry_config
21332
21381
  || {
21333
- strategy: "backoff",
21382
+ strategy: "attempt-count-backoff",
21334
21383
  backoff: {
21335
21384
  initialInterval: 500,
21336
21385
  maxInterval: 8000,
@@ -21338,6 +21387,7 @@ async function $do$2(client, id, api_version, body, options) {
21338
21387
  maxElapsedTime: 30000,
21339
21388
  },
21340
21389
  retryConnectionErrors: true,
21390
+ maxRetries: 4,
21341
21391
  }
21342
21392
  || { strategy: "none" },
21343
21393
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21419,7 +21469,7 @@ async function $do$1(client, id, api_version, body, options) {
21419
21469
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21420
21470
  || client._options.retry_config
21421
21471
  || {
21422
- strategy: "backoff",
21472
+ strategy: "attempt-count-backoff",
21423
21473
  backoff: {
21424
21474
  initialInterval: 500,
21425
21475
  maxInterval: 8000,
@@ -21427,6 +21477,7 @@ async function $do$1(client, id, api_version, body, options) {
21427
21477
  maxElapsedTime: 30000,
21428
21478
  },
21429
21479
  retryConnectionErrors: true,
21480
+ maxRetries: 4,
21430
21481
  }
21431
21482
  || { strategy: "none" },
21432
21483
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21512,7 +21563,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
21512
21563
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21513
21564
  || client._options.retry_config
21514
21565
  || {
21515
- strategy: "backoff",
21566
+ strategy: "attempt-count-backoff",
21516
21567
  backoff: {
21517
21568
  initialInterval: 500,
21518
21569
  maxInterval: 8000,
@@ -21520,6 +21571,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
21520
21571
  maxElapsedTime: 30000,
21521
21572
  },
21522
21573
  retryConnectionErrors: true,
21574
+ maxRetries: 4,
21523
21575
  }
21524
21576
  || { strategy: "none" },
21525
21577
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21786,7 +21838,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
21786
21838
  if (!options && !streaming) {
21787
21839
  return undefined;
21788
21840
  }
21789
- const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries: _maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
21841
+ 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
21842
  const nextOptions = Object.assign({}, rest);
21791
21843
  if (isPlainObject(query)) {
21792
21844
  nextOptions.extra_query = query;
@@ -21812,6 +21864,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
21812
21864
  if (timeout_ms !== undefined) {
21813
21865
  nextOptions.timeout_ms = timeout_ms;
21814
21866
  }
21867
+ if (maxRetries !== undefined) {
21868
+ nextOptions.retries = {
21869
+ strategy: "attempt-count-backoff",
21870
+ retryConnectionErrors: true,
21871
+ maxRetries,
21872
+ };
21873
+ }
21815
21874
  if (streaming) {
21816
21875
  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
21876
  headers.set("Accept", "text/event-stream");
@@ -24051,7 +24110,6 @@ class GoogleGenAI {
24051
24110
  if (this._interactions !== undefined) {
24052
24111
  return this._interactions;
24053
24112
  }
24054
- console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
24055
24113
  this._interactions = new GeminiNextGenInteractions(this.apiClient);
24056
24114
  return this._interactions;
24057
24115
  }