@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/dist/index.cjs CHANGED
@@ -7741,7 +7741,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7741
7741
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7742
7742
  const USER_AGENT_HEADER = 'User-Agent';
7743
7743
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7744
- const SDK_VERSION = '2.9.0-rc.0'; // x-release-please-version
7744
+ const SDK_VERSION = '2.9.0'; // x-release-please-version
7745
7745
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7746
7746
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7747
7747
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -9882,15 +9882,6 @@ class GoogleGenAiError extends Error {
9882
9882
  * g3-prettier-ignore-file
9883
9883
  */
9884
9884
  class GeminiNextGenAPIClientError extends Error {
9885
- static [Symbol.hasInstance](instance) {
9886
- if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
9887
- return true;
9888
- }
9889
- if (this === GeminiNextGenAPIClientError) {
9890
- return isKnownLegacyErrorLike(instance);
9891
- }
9892
- return isNamedLegacyErrorLike(instance, this.name);
9893
- }
9894
9885
  }
9895
9886
  /** General errors raised by the GenAI API. */
9896
9887
  class APIError extends GeminiNextGenAPIClientError {
@@ -9905,6 +9896,7 @@ class APIError extends GeminiNextGenAPIClientError {
9905
9896
  this.rawResponse = undefined;
9906
9897
  this.cause = undefined;
9907
9898
  this.name = this.constructor.name;
9899
+ Object.setPrototypeOf(this, new.target.prototype);
9908
9900
  }
9909
9901
  static makeMessage(status, error, message) {
9910
9902
  var _a;
@@ -9916,15 +9908,6 @@ class APIError extends GeminiNextGenAPIClientError {
9916
9908
  const statusText = status ? `${status} ` : "";
9917
9909
  return `${statusText}${msg}`;
9918
9910
  }
9919
- static [Symbol.hasInstance](instance) {
9920
- if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
9921
- return true;
9922
- }
9923
- if (this === APIError) {
9924
- return isAPIErrorLike(instance);
9925
- }
9926
- return isNamedLegacyErrorLike(instance, this.name);
9927
- }
9928
9911
  static generate(status, errorResponse, message, headers) {
9929
9912
  if (!status || !headers) {
9930
9913
  return new APIConnectionError({
@@ -10065,57 +10048,12 @@ function stringifyErrorBody(error) {
10065
10048
  function isPlainObject$2(value) {
10066
10049
  return value !== null && typeof value === "object" && !Array.isArray(value);
10067
10050
  }
10068
- function isLegacyErrorLike(value) {
10069
- if (!(value instanceof Error) || !isPlainObject$2(value)) {
10070
- return false;
10071
- }
10072
- return ("status" in value ||
10073
- "statusCode" in value ||
10074
- "error" in value ||
10075
- "headers" in value);
10076
- }
10077
- function isAPIErrorLike(value) {
10078
- return isLegacyErrorLike(value) && "error" in value;
10079
- }
10080
10051
  function isCompatAPIErrorInstance(value) {
10052
+ // Avoid instanceof here so this guard never depends on Symbol.hasInstance.
10081
10053
  return typeof value === "object" && value !== null
10082
10054
  ? APIError.prototype.isPrototypeOf(value)
10083
10055
  : false;
10084
10056
  }
10085
- const knownLegacyErrorNames = [
10086
- "GeminiNextGenAPIClientError",
10087
- "APIError",
10088
- "APIUserAbortError",
10089
- "APIConnectionError",
10090
- "APIConnectionTimeoutError",
10091
- "BadRequestError",
10092
- "AuthenticationError",
10093
- "PermissionDeniedError",
10094
- "NotFoundError",
10095
- "ConflictError",
10096
- "UnprocessableEntityError",
10097
- "RateLimitError",
10098
- "InternalServerError",
10099
- ];
10100
- const legacySubclassNamesByBaseName = {
10101
- GeminiNextGenAPIClientError: knownLegacyErrorNames,
10102
- APIConnectionError: ["APIConnectionTimeoutError"],
10103
- };
10104
- function isKnownLegacyErrorLike(value) {
10105
- if (!isLegacyErrorLike(value)) {
10106
- return false;
10107
- }
10108
- return knownLegacyErrorNames.includes(value.name);
10109
- }
10110
- function isNamedLegacyErrorLike(value, name) {
10111
- var _a, _b;
10112
- if (!isLegacyErrorLike(value)) {
10113
- return false;
10114
- }
10115
- const valueName = value.name;
10116
- return (valueName === name ||
10117
- ((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
10118
- }
10119
10057
  function defineReadonly(target, key, value) {
10120
10058
  Object.defineProperty(target, key, {
10121
10059
  configurable: true,
@@ -10325,7 +10263,7 @@ function serverURLFromOptions(options) {
10325
10263
  return new URL(u);
10326
10264
  }
10327
10265
  const SDK_METADATA = {
10328
- userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.904.2 v1beta @google/genai",
10266
+ userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
10329
10267
  };
10330
10268
 
10331
10269
  /**
@@ -10874,14 +10812,19 @@ async function retry(fetchFn, options) {
10874
10812
  statusCodes: options.statusCodes,
10875
10813
  retryConnectionErrors: !!options.config.retryConnectionErrors,
10876
10814
  }), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
10815
+ case "attempt-count-backoff":
10816
+ return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
10817
+ statusCodes: options.statusCodes,
10818
+ retryConnectionErrors: !!options.config.retryConnectionErrors,
10819
+ }), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
10877
10820
  default:
10878
- return await fetchFn();
10821
+ return await fetchFn(0);
10879
10822
  }
10880
10823
  }
10881
10824
  function wrapFetcher(fn, options) {
10882
- return async () => {
10825
+ return async (attempt) => {
10883
10826
  try {
10884
- const res = await fn();
10827
+ const res = await fn(attempt);
10885
10828
  if (isRetryableResponse(res, options.statusCodes)) {
10886
10829
  throw new TemporaryError("Response failed with retryable status code", res);
10887
10830
  }
@@ -10923,7 +10866,7 @@ async function retryBackoff(fn, strategy) {
10923
10866
  let x = 0;
10924
10867
  while (true) {
10925
10868
  try {
10926
- const res = await fn();
10869
+ const res = await fn(x);
10927
10870
  return res;
10928
10871
  }
10929
10872
  catch (err) {
@@ -10951,7 +10894,46 @@ async function retryBackoff(fn, strategy) {
10951
10894
  }
10952
10895
  }
10953
10896
  }
10897
+ async function retryAttemptCountBackoff(fn, strategy, config) {
10898
+ let attempt = 0;
10899
+ while (true) {
10900
+ try {
10901
+ return await fn(attempt);
10902
+ }
10903
+ catch (err) {
10904
+ if (err instanceof PermanentError) {
10905
+ throw err.cause;
10906
+ }
10907
+ if (attempt >= config.maxRetries) {
10908
+ if (err instanceof TemporaryError) {
10909
+ return err.response;
10910
+ }
10911
+ throw err;
10912
+ }
10913
+ let retryInterval = 0;
10914
+ if (err instanceof TemporaryError) {
10915
+ retryInterval = retryIntervalFromResponse(err.response);
10916
+ }
10917
+ if (retryInterval <= 0) {
10918
+ retryInterval =
10919
+ strategy.initialInterval *
10920
+ Math.pow(strategy.exponent, attempt) *
10921
+ (1 - Math.random() * 0.25);
10922
+ }
10923
+ const d = Math.min(retryInterval, strategy.maxInterval);
10924
+ await delay(d);
10925
+ attempt++;
10926
+ }
10927
+ }
10928
+ }
10954
10929
  function retryIntervalFromResponse(res) {
10930
+ const retryAfterMsVal = res.headers.get("retry-after-ms");
10931
+ if (retryAfterMsVal) {
10932
+ const parsedMs = Number(retryAfterMsVal);
10933
+ if (Number.isFinite(parsedMs) && parsedMs >= 0) {
10934
+ return parsedMs;
10935
+ }
10936
+ }
10955
10937
  const retryVal = res.headers.get("retry-after") || "";
10956
10938
  if (!retryVal) {
10957
10939
  return 0;
@@ -11406,13 +11388,12 @@ class Stream extends ReadableStream {
11406
11388
  cancel: reason => upstream.cancel(reason),
11407
11389
  });
11408
11390
  }
11409
- // Polyfill for older browsers
11410
- [Symbol.asyncIterator]() {
11391
+ [Symbol.asyncIterator](options) {
11411
11392
  const fn = ReadableStream.prototype[Symbol.asyncIterator];
11412
11393
  if (typeof fn === "function")
11413
- return fn.call(this);
11394
+ return fn.call(this, options);
11414
11395
  const reader = this.getReader();
11415
- return {
11396
+ const iterator = {
11416
11397
  next: async () => {
11417
11398
  const r = await reader.read();
11418
11399
  if (r.done) {
@@ -11435,6 +11416,17 @@ class Stream extends ReadableStream {
11435
11416
  return this;
11436
11417
  },
11437
11418
  };
11419
+ const asyncDispose = Symbol.asyncDispose;
11420
+ if (asyncDispose) {
11421
+ iterator[asyncDispose] = async () => {
11422
+ var _a;
11423
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
11424
+ };
11425
+ }
11426
+ return iterator;
11427
+ }
11428
+ values(options) {
11429
+ return this[Symbol.asyncIterator](options);
11438
11430
  }
11439
11431
  }
11440
11432
  const CR = 13;
@@ -11575,7 +11567,16 @@ function match(...matchers) {
11575
11567
  switch (encoding) {
11576
11568
  case "json":
11577
11569
  body = await response.text();
11578
- raw = JSON.parse(body);
11570
+ try {
11571
+ raw = JSON.parse(body);
11572
+ }
11573
+ catch (err) {
11574
+ // Passthrough for malformed error bodies; success bodies must be valid.
11575
+ if (!("err" in matcher)) {
11576
+ throw err;
11577
+ }
11578
+ raw = body;
11579
+ }
11579
11580
  break;
11580
11581
  case "jsonl":
11581
11582
  raw = response.body;
@@ -11933,7 +11934,7 @@ async function $do$e(client, body, api_version, options) {
11933
11934
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
11934
11935
  || client._options.retry_config
11935
11936
  || {
11936
- strategy: "backoff",
11937
+ strategy: "attempt-count-backoff",
11937
11938
  backoff: {
11938
11939
  initialInterval: 500,
11939
11940
  maxInterval: 8000,
@@ -11941,6 +11942,7 @@ async function $do$e(client, body, api_version, options) {
11941
11942
  maxElapsedTime: 30000,
11942
11943
  },
11943
11944
  retryConnectionErrors: true,
11945
+ maxRetries: 4,
11944
11946
  }
11945
11947
  || { strategy: "none" },
11946
11948
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12020,7 +12022,7 @@ async function $do$d(client, id, api_version, options) {
12020
12022
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12021
12023
  || client._options.retry_config
12022
12024
  || {
12023
- strategy: "backoff",
12025
+ strategy: "attempt-count-backoff",
12024
12026
  backoff: {
12025
12027
  initialInterval: 500,
12026
12028
  maxInterval: 8000,
@@ -12028,6 +12030,7 @@ async function $do$d(client, id, api_version, options) {
12028
12030
  maxElapsedTime: 30000,
12029
12031
  },
12030
12032
  retryConnectionErrors: true,
12033
+ maxRetries: 4,
12031
12034
  }
12032
12035
  || { strategy: "none" },
12033
12036
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12107,7 +12110,7 @@ async function $do$c(client, id, api_version, options) {
12107
12110
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12108
12111
  || client._options.retry_config
12109
12112
  || {
12110
- strategy: "backoff",
12113
+ strategy: "attempt-count-backoff",
12111
12114
  backoff: {
12112
12115
  initialInterval: 500,
12113
12116
  maxInterval: 8000,
@@ -12115,6 +12118,7 @@ async function $do$c(client, id, api_version, options) {
12115
12118
  maxElapsedTime: 30000,
12116
12119
  },
12117
12120
  retryConnectionErrors: true,
12121
+ maxRetries: 4,
12118
12122
  }
12119
12123
  || { strategy: "none" },
12120
12124
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12197,7 +12201,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
12197
12201
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12198
12202
  || client._options.retry_config
12199
12203
  || {
12200
- strategy: "backoff",
12204
+ strategy: "attempt-count-backoff",
12201
12205
  backoff: {
12202
12206
  initialInterval: 500,
12203
12207
  maxInterval: 8000,
@@ -12205,6 +12209,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
12205
12209
  maxElapsedTime: 30000,
12206
12210
  },
12207
12211
  retryConnectionErrors: true,
12212
+ maxRetries: 4,
12208
12213
  }
12209
12214
  || { strategy: "none" },
12210
12215
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12467,7 +12472,7 @@ async function $do$a(client, id, api_version, options) {
12467
12472
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12468
12473
  || client._options.retry_config
12469
12474
  || {
12470
- strategy: "backoff",
12475
+ strategy: "attempt-count-backoff",
12471
12476
  backoff: {
12472
12477
  initialInterval: 500,
12473
12478
  maxInterval: 8000,
@@ -12475,6 +12480,7 @@ async function $do$a(client, id, api_version, options) {
12475
12480
  maxElapsedTime: 30000,
12476
12481
  },
12477
12482
  retryConnectionErrors: true,
12483
+ maxRetries: 4,
12478
12484
  }
12479
12485
  || { strategy: "none" },
12480
12486
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12551,7 +12557,7 @@ async function $do$9(client, body, api_version, options) {
12551
12557
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12552
12558
  || client._options.retry_config
12553
12559
  || {
12554
- strategy: "backoff",
12560
+ strategy: "attempt-count-backoff",
12555
12561
  backoff: {
12556
12562
  initialInterval: 500,
12557
12563
  maxInterval: 8000,
@@ -12559,6 +12565,7 @@ async function $do$9(client, body, api_version, options) {
12559
12565
  maxElapsedTime: 30000,
12560
12566
  },
12561
12567
  retryConnectionErrors: true,
12568
+ maxRetries: 4,
12562
12569
  }
12563
12570
  || { strategy: "none" },
12564
12571
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12647,7 +12654,7 @@ async function $do$8(client, id, api_version, options) {
12647
12654
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12648
12655
  || client._options.retry_config
12649
12656
  || {
12650
- strategy: "backoff",
12657
+ strategy: "attempt-count-backoff",
12651
12658
  backoff: {
12652
12659
  initialInterval: 500,
12653
12660
  maxInterval: 8000,
@@ -12655,6 +12662,7 @@ async function $do$8(client, id, api_version, options) {
12655
12662
  maxElapsedTime: 30000,
12656
12663
  },
12657
12664
  retryConnectionErrors: true,
12665
+ maxRetries: 4,
12658
12666
  }
12659
12667
  || { strategy: "none" },
12660
12668
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12742,7 +12750,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
12742
12750
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12743
12751
  || client._options.retry_config
12744
12752
  || {
12745
- strategy: "backoff",
12753
+ strategy: "attempt-count-backoff",
12746
12754
  backoff: {
12747
12755
  initialInterval: 500,
12748
12756
  maxInterval: 8000,
@@ -12750,6 +12758,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
12750
12758
  maxElapsedTime: 30000,
12751
12759
  },
12752
12760
  retryConnectionErrors: true,
12761
+ maxRetries: 4,
12753
12762
  }
12754
12763
  || { strategy: "none" },
12755
12764
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12868,7 +12877,7 @@ async function $do$6(client, body, api_version, options) {
12868
12877
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12869
12878
  || client._options.retry_config
12870
12879
  || {
12871
- strategy: "backoff",
12880
+ strategy: "attempt-count-backoff",
12872
12881
  backoff: {
12873
12882
  initialInterval: 500,
12874
12883
  maxInterval: 8000,
@@ -12876,6 +12885,7 @@ async function $do$6(client, body, api_version, options) {
12876
12885
  maxElapsedTime: 30000,
12877
12886
  },
12878
12887
  retryConnectionErrors: true,
12888
+ maxRetries: 4,
12879
12889
  }
12880
12890
  || { strategy: "none" },
12881
12891
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -12955,7 +12965,7 @@ async function $do$5(client, id, api_version, options) {
12955
12965
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
12956
12966
  || client._options.retry_config
12957
12967
  || {
12958
- strategy: "backoff",
12968
+ strategy: "attempt-count-backoff",
12959
12969
  backoff: {
12960
12970
  initialInterval: 500,
12961
12971
  maxInterval: 8000,
@@ -12963,6 +12973,7 @@ async function $do$5(client, id, api_version, options) {
12963
12973
  maxElapsedTime: 30000,
12964
12974
  },
12965
12975
  retryConnectionErrors: true,
12976
+ maxRetries: 4,
12966
12977
  }
12967
12978
  || { strategy: "none" },
12968
12979
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13042,7 +13053,7 @@ async function $do$4(client, id, api_version, options) {
13042
13053
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
13043
13054
  || client._options.retry_config
13044
13055
  || {
13045
- strategy: "backoff",
13056
+ strategy: "attempt-count-backoff",
13046
13057
  backoff: {
13047
13058
  initialInterval: 500,
13048
13059
  maxInterval: 8000,
@@ -13050,6 +13061,7 @@ async function $do$4(client, id, api_version, options) {
13050
13061
  maxElapsedTime: 30000,
13051
13062
  },
13052
13063
  retryConnectionErrors: true,
13064
+ maxRetries: 4,
13053
13065
  }
13054
13066
  || { strategy: "none" },
13055
13067
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13130,7 +13142,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
13130
13142
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
13131
13143
  || client._options.retry_config
13132
13144
  || {
13133
- strategy: "backoff",
13145
+ strategy: "attempt-count-backoff",
13134
13146
  backoff: {
13135
13147
  initialInterval: 500,
13136
13148
  maxInterval: 8000,
@@ -13138,6 +13150,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
13138
13150
  maxElapsedTime: 30000,
13139
13151
  },
13140
13152
  retryConnectionErrors: true,
13153
+ maxRetries: 4,
13141
13154
  }
13142
13155
  || { strategy: "none" },
13143
13156
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13220,7 +13233,7 @@ async function $do$2(client, id, api_version, body, options) {
13220
13233
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
13221
13234
  || client._options.retry_config
13222
13235
  || {
13223
- strategy: "backoff",
13236
+ strategy: "attempt-count-backoff",
13224
13237
  backoff: {
13225
13238
  initialInterval: 500,
13226
13239
  maxInterval: 8000,
@@ -13228,6 +13241,7 @@ async function $do$2(client, id, api_version, body, options) {
13228
13241
  maxElapsedTime: 30000,
13229
13242
  },
13230
13243
  retryConnectionErrors: true,
13244
+ maxRetries: 4,
13231
13245
  }
13232
13246
  || { strategy: "none" },
13233
13247
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13309,7 +13323,7 @@ async function $do$1(client, id, api_version, body, options) {
13309
13323
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
13310
13324
  || client._options.retry_config
13311
13325
  || {
13312
- strategy: "backoff",
13326
+ strategy: "attempt-count-backoff",
13313
13327
  backoff: {
13314
13328
  initialInterval: 500,
13315
13329
  maxInterval: 8000,
@@ -13317,6 +13331,7 @@ async function $do$1(client, id, api_version, body, options) {
13317
13331
  maxElapsedTime: 30000,
13318
13332
  },
13319
13333
  retryConnectionErrors: true,
13334
+ maxRetries: 4,
13320
13335
  }
13321
13336
  || { strategy: "none" },
13322
13337
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13402,7 +13417,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
13402
13417
  retry_config: (options === null || options === void 0 ? void 0 : options.retries)
13403
13418
  || client._options.retry_config
13404
13419
  || {
13405
- strategy: "backoff",
13420
+ strategy: "attempt-count-backoff",
13406
13421
  backoff: {
13407
13422
  initialInterval: 500,
13408
13423
  maxInterval: 8000,
@@ -13410,6 +13425,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
13410
13425
  maxElapsedTime: 30000,
13411
13426
  },
13412
13427
  retryConnectionErrors: true,
13428
+ maxRetries: 4,
13413
13429
  }
13414
13430
  || { strategy: "none" },
13415
13431
  retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
@@ -13676,7 +13692,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
13676
13692
  if (!options && !streaming) {
13677
13693
  return undefined;
13678
13694
  }
13679
- 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"]);
13695
+ const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
13680
13696
  const nextOptions = Object.assign({}, rest);
13681
13697
  if (isPlainObject(query)) {
13682
13698
  nextOptions.extra_query = query;
@@ -13702,6 +13718,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
13702
13718
  if (timeout_ms !== undefined) {
13703
13719
  nextOptions.timeout_ms = timeout_ms;
13704
13720
  }
13721
+ if (maxRetries !== undefined) {
13722
+ nextOptions.retries = {
13723
+ strategy: "attempt-count-backoff",
13724
+ retryConnectionErrors: true,
13725
+ maxRetries,
13726
+ };
13727
+ }
13705
13728
  if (streaming) {
13706
13729
  const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
13707
13730
  headers.set("Accept", "text/event-stream");
@@ -13899,6 +13922,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
13899
13922
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
13900
13923
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
13901
13924
  }
13925
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
13926
+ if (fromLanguageAuto != null) {
13927
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
13928
+ }
13929
+ const fromLanguageHints = getValueByPath(fromObject, [
13930
+ 'languageHints',
13931
+ ]);
13932
+ if (fromLanguageHints != null) {
13933
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
13934
+ }
13935
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
13936
+ 'adaptationPhrases',
13937
+ ]);
13938
+ if (fromAdaptationPhrases != null) {
13939
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
13940
+ }
13902
13941
  return toObject;
13903
13942
  }
13904
13943
  function authConfigToMldev$2(fromObject) {
@@ -15079,6 +15118,10 @@ function voiceActivityFromVertex(fromObject) {
15079
15118
  if (fromVoiceActivityType != null) {
15080
15119
  setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
15081
15120
  }
15121
+ const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
15122
+ if (fromAudioOffset != null) {
15123
+ setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
15124
+ }
15082
15125
  return toObject;
15083
15126
  }
15084
15127
 
@@ -21370,6 +21413,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
21370
21413
  if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
21371
21414
  throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
21372
21415
  }
21416
+ const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
21417
+ if (fromLanguageAuto != null) {
21418
+ setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
21419
+ }
21420
+ const fromLanguageHints = getValueByPath(fromObject, [
21421
+ 'languageHints',
21422
+ ]);
21423
+ if (fromLanguageHints != null) {
21424
+ setValueByPath(toObject, ['languageHints'], fromLanguageHints);
21425
+ }
21426
+ const fromAdaptationPhrases = getValueByPath(fromObject, [
21427
+ 'adaptationPhrases',
21428
+ ]);
21429
+ if (fromAdaptationPhrases != null) {
21430
+ setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
21431
+ }
21373
21432
  return toObject;
21374
21433
  }
21375
21434
  function authConfigToMldev(fromObject) {
@@ -24010,7 +24069,6 @@ class GoogleGenAI {
24010
24069
  if (this._interactions !== undefined) {
24011
24070
  return this._interactions;
24012
24071
  }
24013
- console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
24014
24072
  this._interactions = new GeminiNextGenInteractions(this.apiClient);
24015
24073
  return this._interactions;
24016
24074
  }