ai 7.0.93 → 7.0.94

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.
@@ -1,7 +1,7 @@
1
1
  import * as _ai_sdk_provider from '@ai-sdk/provider';
2
2
  import { EmbeddingModelV4Embedding, LanguageModelV4Source, SharedV4Warning, LanguageModelV4, LanguageModelV3, LanguageModelV2, SharedV4ProviderMetadata, JSONObject, LanguageModelV4Usage, LanguageModelV4CallOptions, LanguageModelV4Prompt, AISDKError, LanguageModelV4ToolCall, JSONSchema7, ProviderV4, ProviderV3, ProviderV2, LanguageModelV4ToolResultOutput, LanguageModelV4ToolChoice, LanguageModelV4FunctionTool, LanguageModelV4ProviderTool } from '@ai-sdk/provider';
3
3
  import { GatewayModelId } from '@ai-sdk/gateway';
4
- import { ModelMessage, AssistantModelMessage, ToolModelMessage, ProviderOptions, ToolSet, SystemModelMessage, Context, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, MaybePromiseLike, ToolExecutionOptions, InferToolContext, ToolResultOutput, Tool, Experimental_SandboxSession, RetryFunction, ToolApprovalRequest, ToolApprovalResponse, ToolResultPart } from '@ai-sdk/provider-utils';
4
+ import { ModelMessage, AssistantModelMessage, ToolModelMessage, ProviderOptions, ToolSet, SystemModelMessage, Context, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, MaybePromiseLike, ToolExecutionOptions, InferToolContext, ToolResultOutput, Tool, Experimental_SandboxSession, ShouldRetryFunction, RetryFunction, ToolApprovalRequest, ToolApprovalResponse, ToolResultPart } from '@ai-sdk/provider-utils';
5
5
  export { convertAsyncIteratorToReadableStream } from '@ai-sdk/provider-utils';
6
6
 
7
7
  /**
@@ -2591,9 +2591,10 @@ declare function prepareLanguageModelCallOptions({ maxOutputTokens, temperature,
2591
2591
  /**
2592
2592
  * Validate and prepare retries.
2593
2593
  */
2594
- declare function prepareRetries({ maxRetries, abortSignal, parameter, defaultMaxRetries, }: {
2594
+ declare function prepareRetries({ maxRetries, abortSignal, additionalRetryableError, parameter, defaultMaxRetries, }: {
2595
2595
  maxRetries: number | undefined;
2596
2596
  abortSignal: AbortSignal | undefined;
2597
+ additionalRetryableError?: ShouldRetryFunction;
2597
2598
  parameter?: string;
2598
2599
  defaultMaxRetries?: number;
2599
2600
  }): {
@@ -91,7 +91,7 @@ import {
91
91
  } from "@ai-sdk/provider-utils";
92
92
 
93
93
  // src/version.ts
94
- var VERSION = true ? "7.0.93" : "0.0.0-test";
94
+ var VERSION = true ? "7.0.94" : "0.0.0-test";
95
95
 
96
96
  // src/util/download/download.ts
97
97
  var download = async ({
@@ -1740,13 +1740,14 @@ var retryWithExponentialBackoffRespectingRetryHeaders = ({
1740
1740
  maxRetries = 2,
1741
1741
  initialDelayInMs = 2e3,
1742
1742
  backoffFactor = 2,
1743
- abortSignal
1743
+ abortSignal,
1744
+ additionalRetryableError
1744
1745
  } = {}) => retryWithExponentialBackoff({
1745
1746
  maxRetries,
1746
1747
  initialDelayInMs,
1747
1748
  backoffFactor,
1748
1749
  abortSignal,
1749
- shouldRetry: (error) => error instanceof Error && (APICallError.isInstance(error) && error.isRetryable === true || GatewayError.isInstance(error) && error.isRetryable === true),
1750
+ shouldRetry: async (error) => error instanceof Error && (APICallError.isInstance(error) && error.isRetryable === true || GatewayError.isInstance(error) && error.isRetryable === true) || additionalRetryableError != null && await additionalRetryableError(error),
1750
1751
  getDelayInMs: ({ error, exponentialBackoffDelay }) => getRetryDelayInMs({
1751
1752
  error,
1752
1753
  exponentialBackoffDelay
@@ -1758,6 +1759,7 @@ var retryWithExponentialBackoffRespectingRetryHeaders = ({
1758
1759
  function prepareRetries({
1759
1760
  maxRetries,
1760
1761
  abortSignal,
1762
+ additionalRetryableError,
1761
1763
  parameter = "maxRetries",
1762
1764
  defaultMaxRetries = 2
1763
1765
  }) {
@@ -1782,7 +1784,8 @@ function prepareRetries({
1782
1784
  maxRetries: maxRetriesResult,
1783
1785
  retry: retryWithExponentialBackoffRespectingRetryHeaders({
1784
1786
  maxRetries: maxRetriesResult,
1785
- abortSignal
1787
+ abortSignal,
1788
+ additionalRetryableError
1786
1789
  })
1787
1790
  };
1788
1791
  }