@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.
@@ -8003,6 +8003,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
8003
8003
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
8004
8004
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
8005
8005
  }
8006
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
8007
+ if (fromLanguageAuto != null) {
8008
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
8009
+ }
8010
+ const fromLanguageHints = getValueByPath(fromObject, [
8011
+ 'languageHints',
8012
+ ]);
8013
+ if (fromLanguageHints != null) {
8014
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
8015
+ }
8016
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
8017
+ 'adaptationPhrases',
8018
+ ]);
8019
+ if (fromAdaptationPhrases != null) {
8020
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
8021
+ }
8006
8022
  return toObject;
8007
8023
  }
8008
8024
  function authConfigToMldev$2(fromObject) {
@@ -9183,6 +9199,10 @@ function voiceActivityFromVertex(fromObject) {
9183
9199
  if (fromVoiceActivityType != null) {
9184
9200
  setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
9185
9201
  }
9202
+ const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
9203
+ if (fromAudioOffset != null) {
9204
+ setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
9205
+ }
9186
9206
  return toObject;
9187
9207
  }
9188
9208
 
@@ -13062,7 +13082,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13062
13082
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13063
13083
  const USER_AGENT_HEADER = 'User-Agent';
13064
13084
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13065
- const SDK_VERSION = '2.9.0-rc.0'; // x-release-please-version
13085
+ const SDK_VERSION = '2.9.0'; // x-release-please-version
13066
13086
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13067
13087
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13068
13088
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -16416,6 +16436,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
16416
16436
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
16417
16437
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
16418
16438
  }
16439
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
16440
+ if (fromLanguageAuto != null) {
16441
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
16442
+ }
16443
+ const fromLanguageHints = getValueByPath(fromObject, [
16444
+ 'languageHints',
16445
+ ]);
16446
+ if (fromLanguageHints != null) {
16447
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
16448
+ }
16449
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
16450
+ 'adaptationPhrases',
16451
+ ]);
16452
+ if (fromAdaptationPhrases != null) {
16453
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
16454
+ }
16419
16455
  return toObject;
16420
16456
  }
16421
16457
  function authConfigToMldev(fromObject) {
@@ -18022,15 +18058,6 @@ class GoogleGenAiError extends Error {
18022
18058
  * g3-prettier-ignore-file
18023
18059
  */
18024
18060
  class GeminiNextGenAPIClientError extends Error {
18025
- static [Symbol.hasInstance](instance) {
18026
- if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
18027
- return true;
18028
- }
18029
- if (this === GeminiNextGenAPIClientError) {
18030
- return isKnownLegacyErrorLike(instance);
18031
- }
18032
- return isNamedLegacyErrorLike(instance, this.name);
18033
- }
18034
18061
  }
18035
18062
  /** General errors raised by the GenAI API. */
18036
18063
  class APIError extends GeminiNextGenAPIClientError {
@@ -18045,6 +18072,7 @@ class APIError extends GeminiNextGenAPIClientError {
18045
18072
  this.rawResponse = undefined;
18046
18073
  this.cause = undefined;
18047
18074
  this.name = this.constructor.name;
18075
+ Object.setPrototypeOf(this, new.target.prototype);
18048
18076
  }
18049
18077
  static makeMessage(status, error, message) {
18050
18078
  var _a;
@@ -18056,15 +18084,6 @@ class APIError extends GeminiNextGenAPIClientError {
18056
18084
  const statusText = status ? `${status} ` : "";
18057
18085
  return `${statusText}${msg}`;
18058
18086
  }
18059
- static [Symbol.hasInstance](instance) {
18060
- if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
18061
- return true;
18062
- }
18063
- if (this === APIError) {
18064
- return isAPIErrorLike(instance);
18065
- }
18066
- return isNamedLegacyErrorLike(instance, this.name);
18067
- }
18068
18087
  static generate(status, errorResponse, message, headers) {
18069
18088
  if (!status || !headers) {
18070
18089
  return new APIConnectionError({
@@ -18205,57 +18224,12 @@ function stringifyErrorBody(error) {
18205
18224
  function isPlainObject$2(value) {
18206
18225
  return value !== null && typeof value === "object" && !Array.isArray(value);
18207
18226
  }
18208
- function isLegacyErrorLike(value) {
18209
- if (!(value instanceof Error) || !isPlainObject$2(value)) {
18210
- return false;
18211
- }
18212
- return ("status" in value ||
18213
- "statusCode" in value ||
18214
- "error" in value ||
18215
- "headers" in value);
18216
- }
18217
- function isAPIErrorLike(value) {
18218
- return isLegacyErrorLike(value) && "error" in value;
18219
- }
18220
18227
  function isCompatAPIErrorInstance(value) {
18228
+ // Avoid instanceof here so this guard never depends on Symbol.hasInstance.
18221
18229
  return typeof value === "object" && value !== null
18222
18230
  ? APIError.prototype.isPrototypeOf(value)
18223
18231
  : false;
18224
18232
  }
18225
- const knownLegacyErrorNames = [
18226
- "GeminiNextGenAPIClientError",
18227
- "APIError",
18228
- "APIUserAbortError",
18229
- "APIConnectionError",
18230
- "APIConnectionTimeoutError",
18231
- "BadRequestError",
18232
- "AuthenticationError",
18233
- "PermissionDeniedError",
18234
- "NotFoundError",
18235
- "ConflictError",
18236
- "UnprocessableEntityError",
18237
- "RateLimitError",
18238
- "InternalServerError",
18239
- ];
18240
- const legacySubclassNamesByBaseName = {
18241
- GeminiNextGenAPIClientError: knownLegacyErrorNames,
18242
- APIConnectionError: ["APIConnectionTimeoutError"],
18243
- };
18244
- function isKnownLegacyErrorLike(value) {
18245
- if (!isLegacyErrorLike(value)) {
18246
- return false;
18247
- }
18248
- return knownLegacyErrorNames.includes(value.name);
18249
- }
18250
- function isNamedLegacyErrorLike(value, name) {
18251
- var _a, _b;
18252
- if (!isLegacyErrorLike(value)) {
18253
- return false;
18254
- }
18255
- const valueName = value.name;
18256
- return (valueName === name ||
18257
- ((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
18258
- }
18259
18233
  function defineReadonly(target, key, value) {
18260
18234
  Object.defineProperty(target, key, {
18261
18235
  configurable: true,
@@ -18465,7 +18439,7 @@ function serverURLFromOptions(options) {
18465
18439
  return new URL(u);
18466
18440
  }
18467
18441
  const SDK_METADATA = {
18468
- userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.904.2 v1beta @google/genai",
18442
+ userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
18469
18443
  };
18470
18444
 
18471
18445
  /**
@@ -19014,14 +18988,19 @@ async function retry(fetchFn, options) {
19014
18988
  statusCodes: options.statusCodes,
19015
18989
  retryConnectionErrors: !!options.config.retryConnectionErrors,
19016
18990
  }), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
18991
+ case "attempt-count-backoff":
18992
+ return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
18993
+ statusCodes: options.statusCodes,
18994
+ retryConnectionErrors: !!options.config.retryConnectionErrors,
18995
+ }), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
19017
18996
  default:
19018
- return await fetchFn();
18997
+ return await fetchFn(0);
19019
18998
  }
19020
18999
  }
19021
19000
  function wrapFetcher(fn, options) {
19022
- return async () => {
19001
+ return async (attempt) => {
19023
19002
  try {
19024
- const res = await fn();
19003
+ const res = await fn(attempt);
19025
19004
  if (isRetryableResponse(res, options.statusCodes)) {
19026
19005
  throw new TemporaryError("Response failed with retryable status code", res);
19027
19006
  }
@@ -19063,7 +19042,7 @@ async function retryBackoff(fn, strategy) {
19063
19042
  let x = 0;
19064
19043
  while (true) {
19065
19044
  try {
19066
- const res = await fn();
19045
+ const res = await fn(x);
19067
19046
  return res;
19068
19047
  }
19069
19048
  catch (err) {
@@ -19091,7 +19070,46 @@ async function retryBackoff(fn, strategy) {
19091
19070
  }
19092
19071
  }
19093
19072
  }
19073
+ async function retryAttemptCountBackoff(fn, strategy, config) {
19074
+ let attempt = 0;
19075
+ while (true) {
19076
+ try {
19077
+ return await fn(attempt);
19078
+ }
19079
+ catch (err) {
19080
+ if (err instanceof PermanentError) {
19081
+ throw err.cause;
19082
+ }
19083
+ if (attempt >= config.maxRetries) {
19084
+ if (err instanceof TemporaryError) {
19085
+ return err.response;
19086
+ }
19087
+ throw err;
19088
+ }
19089
+ let retryInterval = 0;
19090
+ if (err instanceof TemporaryError) {
19091
+ retryInterval = retryIntervalFromResponse(err.response);
19092
+ }
19093
+ if (retryInterval <= 0) {
19094
+ retryInterval =
19095
+ strategy.initialInterval *
19096
+ Math.pow(strategy.exponent, attempt) *
19097
+ (1 - Math.random() * 0.25);
19098
+ }
19099
+ const d = Math.min(retryInterval, strategy.maxInterval);
19100
+ await delay(d);
19101
+ attempt++;
19102
+ }
19103
+ }
19104
+ }
19094
19105
  function retryIntervalFromResponse(res) {
19106
+ const retryAfterMsVal = res.headers.get("retry-after-ms");
19107
+ if (retryAfterMsVal) {
19108
+ const parsedMs = Number(retryAfterMsVal);
19109
+ if (Number.isFinite(parsedMs) && parsedMs >= 0) {
19110
+ return parsedMs;
19111
+ }
19112
+ }
19095
19113
  const retryVal = res.headers.get("retry-after") || "";
19096
19114
  if (!retryVal) {
19097
19115
  return 0;
@@ -19546,13 +19564,12 @@ class Stream extends ReadableStream {
19546
19564
  cancel: reason => upstream.cancel(reason),
19547
19565
  });
19548
19566
  }
19549
- // Polyfill for older browsers
19550
- [Symbol.asyncIterator]() {
19567
+ [Symbol.asyncIterator](options) {
19551
19568
  const fn = ReadableStream.prototype[Symbol.asyncIterator];
19552
19569
  if (typeof fn === "function")
19553
- return fn.call(this);
19570
+ return fn.call(this, options);
19554
19571
  const reader = this.getReader();
19555
- return {
19572
+ const iterator = {
19556
19573
  next: async () => {
19557
19574
  const r = await reader.read();
19558
19575
  if (r.done) {
@@ -19575,6 +19592,17 @@ class Stream extends ReadableStream {
19575
19592
  return this;
19576
19593
  },
19577
19594
  };
19595
+ const asyncDispose = Symbol.asyncDispose;
19596
+ if (asyncDispose) {
19597
+ iterator[asyncDispose] = async () => {
19598
+ var _a;
19599
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
19600
+ };
19601
+ }
19602
+ return iterator;
19603
+ }
19604
+ values(options) {
19605
+ return this[Symbol.asyncIterator](options);
19578
19606
  }
19579
19607
  }
19580
19608
  const CR = 13;
@@ -19715,7 +19743,16 @@ function match(...matchers) {
19715
19743
  switch (encoding) {
19716
19744
  case "json":
19717
19745
  body = await response.text();
19718
- raw = JSON.parse(body);
19746
+ try {
19747
+ raw = JSON.parse(body);
19748
+ }
19749
+ catch (err) {
19750
+ // Passthrough for malformed error bodies; success bodies must be valid.
19751
+ if (!("err" in matcher)) {
19752
+ throw err;
19753
+ }
19754
+ raw = body;
19755
+ }
19719
19756
  break;
19720
19757
  case "jsonl":
19721
19758
  raw = response.body;
@@ -20073,7 +20110,7 @@ async function $do$e(client, body, api_version, options) {
20073
20110
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20074
20111
  || client._options.retry_config
20075
20112
  || {
20076
- strategy: "backoff",
20113
+ strategy: "attempt-count-backoff",
20077
20114
  backoff: {
20078
20115
  initialInterval: 500,
20079
20116
  maxInterval: 8000,
@@ -20081,6 +20118,7 @@ async function $do$e(client, body, api_version, options) {
20081
20118
  maxElapsedTime: 30000,
20082
20119
  },
20083
20120
  retryConnectionErrors: true,
20121
+ maxRetries: 4,
20084
20122
  }
20085
20123
  || { strategy: "none" },
20086
20124
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20160,7 +20198,7 @@ async function $do$d(client, id, api_version, options) {
20160
20198
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20161
20199
  || client._options.retry_config
20162
20200
  || {
20163
- strategy: "backoff",
20201
+ strategy: "attempt-count-backoff",
20164
20202
  backoff: {
20165
20203
  initialInterval: 500,
20166
20204
  maxInterval: 8000,
@@ -20168,6 +20206,7 @@ async function $do$d(client, id, api_version, options) {
20168
20206
  maxElapsedTime: 30000,
20169
20207
  },
20170
20208
  retryConnectionErrors: true,
20209
+ maxRetries: 4,
20171
20210
  }
20172
20211
  || { strategy: "none" },
20173
20212
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20247,7 +20286,7 @@ async function $do$c(client, id, api_version, options) {
20247
20286
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20248
20287
  || client._options.retry_config
20249
20288
  || {
20250
- strategy: "backoff",
20289
+ strategy: "attempt-count-backoff",
20251
20290
  backoff: {
20252
20291
  initialInterval: 500,
20253
20292
  maxInterval: 8000,
@@ -20255,6 +20294,7 @@ async function $do$c(client, id, api_version, options) {
20255
20294
  maxElapsedTime: 30000,
20256
20295
  },
20257
20296
  retryConnectionErrors: true,
20297
+ maxRetries: 4,
20258
20298
  }
20259
20299
  || { strategy: "none" },
20260
20300
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20337,7 +20377,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
20337
20377
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20338
20378
  || client._options.retry_config
20339
20379
  || {
20340
- strategy: "backoff",
20380
+ strategy: "attempt-count-backoff",
20341
20381
  backoff: {
20342
20382
  initialInterval: 500,
20343
20383
  maxInterval: 8000,
@@ -20345,6 +20385,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
20345
20385
  maxElapsedTime: 30000,
20346
20386
  },
20347
20387
  retryConnectionErrors: true,
20388
+ maxRetries: 4,
20348
20389
  }
20349
20390
  || { strategy: "none" },
20350
20391
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20607,7 +20648,7 @@ async function $do$a(client, id, api_version, options) {
20607
20648
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20608
20649
  || client._options.retry_config
20609
20650
  || {
20610
- strategy: "backoff",
20651
+ strategy: "attempt-count-backoff",
20611
20652
  backoff: {
20612
20653
  initialInterval: 500,
20613
20654
  maxInterval: 8000,
@@ -20615,6 +20656,7 @@ async function $do$a(client, id, api_version, options) {
20615
20656
  maxElapsedTime: 30000,
20616
20657
  },
20617
20658
  retryConnectionErrors: true,
20659
+ maxRetries: 4,
20618
20660
  }
20619
20661
  || { strategy: "none" },
20620
20662
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20691,7 +20733,7 @@ async function $do$9(client, body, api_version, options) {
20691
20733
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20692
20734
  || client._options.retry_config
20693
20735
  || {
20694
- strategy: "backoff",
20736
+ strategy: "attempt-count-backoff",
20695
20737
  backoff: {
20696
20738
  initialInterval: 500,
20697
20739
  maxInterval: 8000,
@@ -20699,6 +20741,7 @@ async function $do$9(client, body, api_version, options) {
20699
20741
  maxElapsedTime: 30000,
20700
20742
  },
20701
20743
  retryConnectionErrors: true,
20744
+ maxRetries: 4,
20702
20745
  }
20703
20746
  || { strategy: "none" },
20704
20747
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20787,7 +20830,7 @@ async function $do$8(client, id, api_version, options) {
20787
20830
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20788
20831
  || client._options.retry_config
20789
20832
  || {
20790
- strategy: "backoff",
20833
+ strategy: "attempt-count-backoff",
20791
20834
  backoff: {
20792
20835
  initialInterval: 500,
20793
20836
  maxInterval: 8000,
@@ -20795,6 +20838,7 @@ async function $do$8(client, id, api_version, options) {
20795
20838
  maxElapsedTime: 30000,
20796
20839
  },
20797
20840
  retryConnectionErrors: true,
20841
+ maxRetries: 4,
20798
20842
  }
20799
20843
  || { strategy: "none" },
20800
20844
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -20882,7 +20926,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
20882
20926
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
20883
20927
  || client._options.retry_config
20884
20928
  || {
20885
- strategy: "backoff",
20929
+ strategy: "attempt-count-backoff",
20886
20930
  backoff: {
20887
20931
  initialInterval: 500,
20888
20932
  maxInterval: 8000,
@@ -20890,6 +20934,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
20890
20934
  maxElapsedTime: 30000,
20891
20935
  },
20892
20936
  retryConnectionErrors: true,
20937
+ maxRetries: 4,
20893
20938
  }
20894
20939
  || { strategy: "none" },
20895
20940
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21008,7 +21053,7 @@ async function $do$6(client, body, api_version, options) {
21008
21053
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21009
21054
  || client._options.retry_config
21010
21055
  || {
21011
- strategy: "backoff",
21056
+ strategy: "attempt-count-backoff",
21012
21057
  backoff: {
21013
21058
  initialInterval: 500,
21014
21059
  maxInterval: 8000,
@@ -21016,6 +21061,7 @@ async function $do$6(client, body, api_version, options) {
21016
21061
  maxElapsedTime: 30000,
21017
21062
  },
21018
21063
  retryConnectionErrors: true,
21064
+ maxRetries: 4,
21019
21065
  }
21020
21066
  || { strategy: "none" },
21021
21067
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21095,7 +21141,7 @@ async function $do$5(client, id, api_version, options) {
21095
21141
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21096
21142
  || client._options.retry_config
21097
21143
  || {
21098
- strategy: "backoff",
21144
+ strategy: "attempt-count-backoff",
21099
21145
  backoff: {
21100
21146
  initialInterval: 500,
21101
21147
  maxInterval: 8000,
@@ -21103,6 +21149,7 @@ async function $do$5(client, id, api_version, options) {
21103
21149
  maxElapsedTime: 30000,
21104
21150
  },
21105
21151
  retryConnectionErrors: true,
21152
+ maxRetries: 4,
21106
21153
  }
21107
21154
  || { strategy: "none" },
21108
21155
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21182,7 +21229,7 @@ async function $do$4(client, id, api_version, options) {
21182
21229
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21183
21230
  || client._options.retry_config
21184
21231
  || {
21185
- strategy: "backoff",
21232
+ strategy: "attempt-count-backoff",
21186
21233
  backoff: {
21187
21234
  initialInterval: 500,
21188
21235
  maxInterval: 8000,
@@ -21190,6 +21237,7 @@ async function $do$4(client, id, api_version, options) {
21190
21237
  maxElapsedTime: 30000,
21191
21238
  },
21192
21239
  retryConnectionErrors: true,
21240
+ maxRetries: 4,
21193
21241
  }
21194
21242
  || { strategy: "none" },
21195
21243
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21270,7 +21318,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
21270
21318
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21271
21319
  || client._options.retry_config
21272
21320
  || {
21273
- strategy: "backoff",
21321
+ strategy: "attempt-count-backoff",
21274
21322
  backoff: {
21275
21323
  initialInterval: 500,
21276
21324
  maxInterval: 8000,
@@ -21278,6 +21326,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
21278
21326
  maxElapsedTime: 30000,
21279
21327
  },
21280
21328
  retryConnectionErrors: true,
21329
+ maxRetries: 4,
21281
21330
  }
21282
21331
  || { strategy: "none" },
21283
21332
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21360,7 +21409,7 @@ async function $do$2(client, id, api_version, body, options) {
21360
21409
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21361
21410
  || client._options.retry_config
21362
21411
  || {
21363
- strategy: "backoff",
21412
+ strategy: "attempt-count-backoff",
21364
21413
  backoff: {
21365
21414
  initialInterval: 500,
21366
21415
  maxInterval: 8000,
@@ -21368,6 +21417,7 @@ async function $do$2(client, id, api_version, body, options) {
21368
21417
  maxElapsedTime: 30000,
21369
21418
  },
21370
21419
  retryConnectionErrors: true,
21420
+ maxRetries: 4,
21371
21421
  }
21372
21422
  || { strategy: "none" },
21373
21423
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21449,7 +21499,7 @@ async function $do$1(client, id, api_version, body, options) {
21449
21499
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21450
21500
  || client._options.retry_config
21451
21501
  || {
21452
- strategy: "backoff",
21502
+ strategy: "attempt-count-backoff",
21453
21503
  backoff: {
21454
21504
  initialInterval: 500,
21455
21505
  maxInterval: 8000,
@@ -21457,6 +21507,7 @@ async function $do$1(client, id, api_version, body, options) {
21457
21507
  maxElapsedTime: 30000,
21458
21508
  },
21459
21509
  retryConnectionErrors: true,
21510
+ maxRetries: 4,
21460
21511
  }
21461
21512
  || { strategy: "none" },
21462
21513
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21542,7 +21593,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
21542
21593
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
21543
21594
  || client._options.retry_config
21544
21595
  || {
21545
- strategy: "backoff",
21596
+ strategy: "attempt-count-backoff",
21546
21597
  backoff: {
21547
21598
  initialInterval: 500,
21548
21599
  maxInterval: 8000,
@@ -21550,6 +21601,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
21550
21601
  maxElapsedTime: 30000,
21551
21602
  },
21552
21603
  retryConnectionErrors: true,
21604
+ maxRetries: 4,
21553
21605
  }
21554
21606
  || { strategy: "none" },
21555
21607
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -21816,7 +21868,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
21816
21868
  if (!options && !streaming) {
21817
21869
  return undefined;
21818
21870
  }
21819
- 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"]);
21871
+ const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
21820
21872
  const nextOptions = Object.assign({}, rest);
21821
21873
  if (isPlainObject(query)) {
21822
21874
  nextOptions.extra_query = query;
@@ -21842,6 +21894,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
21842
21894
  if (timeout_ms !== undefined) {
21843
21895
  nextOptions.timeout_ms = timeout_ms;
21844
21896
  }
21897
+ if (maxRetries !== undefined) {
21898
+ nextOptions.retries = {
21899
+ strategy: "attempt-count-backoff",
21900
+ retryConnectionErrors: true,
21901
+ maxRetries,
21902
+ };
21903
+ }
21845
21904
  if (streaming) {
21846
21905
  const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
21847
21906
  headers.set("Accept", "text/event-stream");
@@ -24453,7 +24512,6 @@ class GoogleGenAI {
24453
24512
  if (this._interactions !== undefined) {
24454
24513
  return this._interactions;
24455
24514
  }
24456
- console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
24457
24515
  this._interactions = new GeminiNextGenInteractions(this.apiClient);
24458
24516
  return this._interactions;
24459
24517
  }