ai-retry 1.11.0 → 2.0.0-beta.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 -0
- package/dist/{conditions-CyJOeRZK.mjs → conditions-CfeJD4K4.mjs} +2 -2
- package/dist/{conditions-BGoANmfr.mjs → conditions-DAetW5_1.mjs} +2 -2
- package/dist/{create-retryable-model-DEQ5jciq.mjs → create-retryable-model-CHCZ0fQk.mjs} +3 -3
- package/dist/{create-retryable-model-CLCFZANp.mjs → create-retryable-model-CmfSxgGj.mjs} +3 -3
- package/dist/{create-retryable-model-BIMStLIF.mjs → create-retryable-model-kbZjWNJ0.mjs} +3 -3
- package/dist/embedding-model/conditions/index.d.mts +2 -2
- package/dist/embedding-model/conditions/index.mjs +1 -1
- package/dist/embedding-model/index.d.mts +2 -2
- package/dist/embedding-model/index.mjs +3 -3
- package/dist/{guards-DtZgDqE3.mjs → guards-CKn5dl__.mjs} +3 -3
- package/dist/image-model/conditions/index.d.mts +3 -3
- package/dist/image-model/conditions/index.mjs +2 -2
- package/dist/image-model/index.d.mts +3 -3
- package/dist/image-model/index.mjs +4 -4
- package/dist/{index-BkvvEDSr.d.mts → index-Bo_FxEjD.d.mts} +2 -2
- package/dist/{index-D3t1Xo_U.d.mts → index-ChhH9SEc.d.mts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/language-model/conditions/index.d.mts +3 -3
- package/dist/language-model/conditions/index.mjs +2 -2
- package/dist/language-model/index.d.mts +3 -3
- package/dist/language-model/index.mjs +4 -4
- package/dist/{not-C9pUKPO7.mjs → not-6hBRaJRl.mjs} +1 -1
- package/dist/{or-CFcJxcaL.d.mts → or-MbQSVByG.d.mts} +1 -1
- package/dist/retryables/index.d.mts +1 -1
- package/dist/retryables/index.mjs +1 -1
- package/dist/{telemetry-CJFJzjTr.mjs → telemetry-bNsaXZUI.mjs} +1 -1
- package/dist/{types-B8qg3Yzx.d.mts → types-BrvhJykE.d.mts} +10 -10
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as isErrorAttempt } from "./guards-
|
|
2
|
-
import { a as Condition, r as createErrorAPI } from "./not-
|
|
1
|
+
import { r as isErrorAttempt } from "./guards-CKn5dl__.mjs";
|
|
2
|
+
import { a as Condition, r as createErrorAPI } from "./not-6hBRaJRl.mjs";
|
|
3
3
|
import { NoImageGeneratedError } from "ai";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/conditions/no-image.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as isResultAttempt } from "./guards-
|
|
2
|
-
import { a as Condition, r as createErrorAPI } from "./not-
|
|
1
|
+
import { c as isResultAttempt } from "./guards-CKn5dl__.mjs";
|
|
2
|
+
import { a as Condition, r as createErrorAPI } from "./not-6hBRaJRl.mjs";
|
|
3
3
|
import { safeParseJSON } from "@ai-sdk/provider-utils";
|
|
4
4
|
import { fromJSONSchema } from "zod";
|
|
5
5
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as prepareRetryError, f as calculateExponentialBackoff, n as mergeEmbeddingModelCallOptions, o as findRetryModel, p as BaseRetryableModel, s as resolveEmbeddingModel, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-
|
|
2
|
-
import { o as isModel } from "./guards-
|
|
1
|
+
import { a as prepareRetryError, f as calculateExponentialBackoff, n as mergeEmbeddingModelCallOptions, o as findRetryModel, p as BaseRetryableModel, s as resolveEmbeddingModel, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { o as isModel } from "./guards-CKn5dl__.mjs";
|
|
3
3
|
import { delay } from "@ai-sdk/provider-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/retryable-embedding-model.ts
|
|
6
6
|
var RetryableEmbeddingModel = class extends BaseRetryableModel {
|
|
7
|
-
specificationVersion = "
|
|
7
|
+
specificationVersion = "v4";
|
|
8
8
|
get modelId() {
|
|
9
9
|
return this.currentModel.modelId;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as prepareRetryError, c as resolveImageModel, f as calculateExponentialBackoff, o as findRetryModel, p as BaseRetryableModel, r as mergeImageModelCallOptions, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-
|
|
2
|
-
import { o as isModel } from "./guards-
|
|
1
|
+
import { a as prepareRetryError, c as resolveImageModel, f as calculateExponentialBackoff, o as findRetryModel, p as BaseRetryableModel, r as mergeImageModelCallOptions, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { o as isModel } from "./guards-CKn5dl__.mjs";
|
|
3
3
|
import { delay } from "@ai-sdk/provider-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/retryable-image-model.ts
|
|
6
6
|
var RetryableImageModel = class extends BaseRetryableModel {
|
|
7
|
-
specificationVersion = "
|
|
7
|
+
specificationVersion = "v4";
|
|
8
8
|
get modelId() {
|
|
9
9
|
return this.currentModel.modelId;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as prepareRetryError, f as calculateExponentialBackoff, i as mergeLanguageModelCallOptions, l as resolveLanguageModel, o as findRetryModel, p as BaseRetryableModel, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-
|
|
2
|
-
import { i as isGenerateResult, l as isStreamContentPart, o as isModel, r as isErrorAttempt } from "./guards-
|
|
1
|
+
import { a as prepareRetryError, f as calculateExponentialBackoff, i as mergeLanguageModelCallOptions, l as resolveLanguageModel, o as findRetryModel, p as BaseRetryableModel, t as createRetryTelemetry, u as countModelAttempts } from "./telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { i as isGenerateResult, l as isStreamContentPart, o as isModel, r as isErrorAttempt } from "./guards-CKn5dl__.mjs";
|
|
3
3
|
import { delay } from "@ai-sdk/provider-utils";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/retryable-language-model.ts
|
|
6
6
|
var RetryableLanguageModel = class extends BaseRetryableModel {
|
|
7
|
-
specificationVersion = "
|
|
7
|
+
specificationVersion = "v4";
|
|
8
8
|
get modelId() {
|
|
9
9
|
return this.currentModel.modelId;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as RetryContext, T as ResolvableEmbeddingModel } from "../../types-
|
|
2
|
-
import { a as Condition, i as StatusPattern, n as not, r as and, t as or } from "../../or-
|
|
1
|
+
import { F as RetryContext, T as ResolvableEmbeddingModel } from "../../types-BrvhJykE.mjs";
|
|
2
|
+
import { a as Condition, i as StatusPattern, n as not, r as and, t as or } from "../../or-MbQSVByG.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embedding-model/conditions/index.d.ts
|
|
5
5
|
declare const error: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as or, n as and, r as createErrorAPI, t as not } from "../../not-
|
|
1
|
+
import { i as or, n as and, r as createErrorAPI, t as not } from "../../not-6hBRaJRl.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/embedding-model/conditions/index.ts
|
|
4
4
|
const { error, httpStatus, timeout, aborted } = createErrorAPI();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as RetryableModelOptions, T as ResolvableEmbeddingModel, r as EmbeddingModel } from "../types-
|
|
2
|
-
import { n as not, r as and, t as or } from "../or-
|
|
1
|
+
import { B as RetryableModelOptions, T as ResolvableEmbeddingModel, r as EmbeddingModel } from "../types-BrvhJykE.mjs";
|
|
2
|
+
import { n as not, r as and, t as or } from "../or-MbQSVByG.mjs";
|
|
3
3
|
import { aborted, error, httpStatus, timeout } from "./conditions/index.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/embedding-model/create-retryable-model.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../telemetry-
|
|
2
|
-
import { t as createRetryableModel } from "../create-retryable-model-
|
|
3
|
-
import { i as or, n as and, t as not } from "../not-
|
|
1
|
+
import "../telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { t as createRetryableModel } from "../create-retryable-model-CHCZ0fQk.mjs";
|
|
3
|
+
import { i as or, n as and, t as not } from "../not-6hBRaJRl.mjs";
|
|
4
4
|
import { aborted, error, httpStatus, timeout } from "./conditions/index.mjs";
|
|
5
5
|
|
|
6
6
|
export { aborted, and, createRetryableModel, error, httpStatus, not, or, timeout };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const isObject = (value) => typeof value === "object" && value !== null;
|
|
3
3
|
const isString = (value) => typeof value === "string";
|
|
4
4
|
const isModel = (model) => isLanguageModel(model) || isEmbeddingModel(model) || isImageModel(model);
|
|
5
|
-
const isLanguageModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doGenerate" in model && "doStream" in model && model.specificationVersion === "
|
|
6
|
-
const isEmbeddingModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doEmbed" in model && model.specificationVersion === "
|
|
7
|
-
const isImageModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doGenerate" in model && model.specificationVersion === "
|
|
5
|
+
const isLanguageModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doGenerate" in model && "doStream" in model && model.specificationVersion === "v4";
|
|
6
|
+
const isEmbeddingModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doEmbed" in model && model.specificationVersion === "v4";
|
|
7
|
+
const isImageModel = (model) => isObject(model) && "provider" in model && "modelId" in model && "specificationVersion" in model && "doGenerate" in model && model.specificationVersion === "v4" && !("doStream" in model) && !("doEmbed" in model);
|
|
8
8
|
const isGenerateResult = (result) => "content" in result;
|
|
9
9
|
/**
|
|
10
10
|
* Type guard to check if a retry attempt is an error attempt
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../types-
|
|
2
|
-
import { n as not, r as and, t as or } from "../../or-
|
|
3
|
-
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../../index-
|
|
1
|
+
import "../../types-BrvhJykE.mjs";
|
|
2
|
+
import { n as not, r as and, t as or } from "../../or-MbQSVByG.mjs";
|
|
3
|
+
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../../index-ChhH9SEc.mjs";
|
|
4
4
|
export { aborted, and, error, httpStatus, noImage, not, or, timeout };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as or, n as and, t as not } from "../../not-
|
|
2
|
-
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../../conditions-
|
|
1
|
+
import { i as or, n as and, t as not } from "../../not-6hBRaJRl.mjs";
|
|
2
|
+
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../../conditions-CfeJD4K4.mjs";
|
|
3
3
|
|
|
4
4
|
export { aborted, and, error, httpStatus, noImage, not, or, timeout };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as RetryableModelOptions, E as ResolvableImageModel, d as ImageModel } from "../types-
|
|
2
|
-
import { n as not, r as and, t as or } from "../or-
|
|
3
|
-
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../index-
|
|
1
|
+
import { B as RetryableModelOptions, E as ResolvableImageModel, d as ImageModel } from "../types-BrvhJykE.mjs";
|
|
2
|
+
import { n as not, r as and, t as or } from "../or-MbQSVByG.mjs";
|
|
3
|
+
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../index-ChhH9SEc.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/image-model/create-retryable-model.d.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../telemetry-
|
|
2
|
-
import { t as createRetryableModel } from "../create-retryable-model-
|
|
3
|
-
import { i as or, n as and, t as not } from "../not-
|
|
4
|
-
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../conditions-
|
|
1
|
+
import "../telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { t as createRetryableModel } from "../create-retryable-model-CmfSxgGj.mjs";
|
|
3
|
+
import { i as or, n as and, t as not } from "../not-6hBRaJRl.mjs";
|
|
4
|
+
import { a as noImage, i as timeout, n as error, r as httpStatus, t as aborted } from "../conditions-CfeJD4K4.mjs";
|
|
5
5
|
|
|
6
6
|
export { aborted, and, createRetryableModel, error, httpStatus, noImage, not, or, timeout };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as ResolvableLanguageModel, F as RetryContext, v as LanguageModelResult } from "./types-
|
|
2
|
-
import { a as Condition, i as StatusPattern } from "./or-
|
|
1
|
+
import { D as ResolvableLanguageModel, F as RetryContext, v as LanguageModelResult } from "./types-BrvhJykE.mjs";
|
|
2
|
+
import { a as Condition, i as StatusPattern } from "./or-MbQSVByG.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/conditions/result.d.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ResolvableImageModel, F as RetryContext } from "./types-
|
|
2
|
-
import { a as Condition, i as StatusPattern } from "./or-
|
|
1
|
+
import { E as ResolvableImageModel, F as RetryContext } from "./types-BrvhJykE.mjs";
|
|
2
|
+
import { a as Condition, i as StatusPattern } from "./or-MbQSVByG.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/conditions/no-image.d.ts
|
|
5
5
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Result, B as RetryableModelOptions, C as ProviderOptions, D as ResolvableLanguageModel, E as ResolvableImageModel, F as RetryContext, H as SuccessAttempt, I as RetryErrorAttempt, L as RetryResultAttempt, M as Retry, N as RetryAttempt, O as ResolvableModel, P as RetryCallOptions, R as RetryTelemetrySettings, S as OnRetryOverrides, T as ResolvableEmbeddingModel, U as SuccessContext, V as RetryableOptions, _ as LanguageModelGenerate, a as EmbeddingModelEmbed, b as LanguageModelStream, c as GatewayEmbeddingModelId, d as ImageModel, f as ImageModelCallOptions, g as LanguageModelCallOptions, h as LanguageModel, i as EmbeddingModelCallOptions, j as Retries, k as ResolvedModel, l as GatewayImageModelId, m as ImageModelRetryCallOptions, n as CallOptions, o as EmbeddingModelRetryCallOptions, p as ImageModelGenerate, r as EmbeddingModel, s as FailureContext, t as AnyResolvableModel, u as GatewayLanguageModelId, v as LanguageModelResult, w as Reset, x as LanguageModelStreamPart, y as LanguageModelRetryCallOptions, z as Retryable } from "./types-
|
|
1
|
+
import { A as Result, B as RetryableModelOptions, C as ProviderOptions, D as ResolvableLanguageModel, E as ResolvableImageModel, F as RetryContext, H as SuccessAttempt, I as RetryErrorAttempt, L as RetryResultAttempt, M as Retry, N as RetryAttempt, O as ResolvableModel, P as RetryCallOptions, R as RetryTelemetrySettings, S as OnRetryOverrides, T as ResolvableEmbeddingModel, U as SuccessContext, V as RetryableOptions, _ as LanguageModelGenerate, a as EmbeddingModelEmbed, b as LanguageModelStream, c as GatewayEmbeddingModelId, d as ImageModel, f as ImageModelCallOptions, g as LanguageModelCallOptions, h as LanguageModel, i as EmbeddingModelCallOptions, j as Retries, k as ResolvedModel, l as GatewayImageModelId, m as ImageModelRetryCallOptions, n as CallOptions, o as EmbeddingModelRetryCallOptions, p as ImageModelGenerate, r as EmbeddingModel, s as FailureContext, t as AnyResolvableModel, u as GatewayLanguageModelId, v as LanguageModelResult, w as Reset, x as LanguageModelStreamPart, y as LanguageModelRetryCallOptions, z as Retryable } from "./types-BrvhJykE.mjs";
|
|
2
2
|
import "@ai-sdk/provider";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/create-retryable-model.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as getModelKey, l as resolveLanguageModel } from "./telemetry-
|
|
2
|
-
import { a as isImageModel, c as isResultAttempt, n as isEmbeddingModel, o as isModel, r as isErrorAttempt } from "./guards-
|
|
3
|
-
import { t as createRetryableModel$1 } from "./create-retryable-model-
|
|
4
|
-
import { t as createRetryableModel$2 } from "./create-retryable-model-
|
|
5
|
-
import { t as createRetryableModel$3 } from "./create-retryable-model-
|
|
1
|
+
import { d as getModelKey, l as resolveLanguageModel } from "./telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { a as isImageModel, c as isResultAttempt, n as isEmbeddingModel, o as isModel, r as isErrorAttempt } from "./guards-CKn5dl__.mjs";
|
|
3
|
+
import { t as createRetryableModel$1 } from "./create-retryable-model-CHCZ0fQk.mjs";
|
|
4
|
+
import { t as createRetryableModel$2 } from "./create-retryable-model-CmfSxgGj.mjs";
|
|
5
|
+
import { t as createRetryableModel$3 } from "./create-retryable-model-kbZjWNJ0.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/internal/create-retryable-model.ts
|
|
8
8
|
function createRetryableModel(options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../types-
|
|
2
|
-
import { n as not, r as and, t as or } from "../../or-
|
|
3
|
-
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../../index-
|
|
1
|
+
import "../../types-BrvhJykE.mjs";
|
|
2
|
+
import { n as not, r as and, t as or } from "../../or-MbQSVByG.mjs";
|
|
3
|
+
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../../index-Bo_FxEjD.mjs";
|
|
4
4
|
export { aborted, and, error, finishReason, httpStatus, not, or, result, schemaInvalid, timeout };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as or, n as and, t as not } from "../../not-
|
|
2
|
-
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../../conditions-
|
|
1
|
+
import { i as or, n as and, t as not } from "../../not-6hBRaJRl.mjs";
|
|
2
|
+
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../../conditions-DAetW5_1.mjs";
|
|
3
3
|
|
|
4
4
|
export { aborted, and, error, finishReason, httpStatus, not, or, result, schemaInvalid, timeout };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as RetryableModelOptions, D as ResolvableLanguageModel, h as LanguageModel } from "../types-
|
|
2
|
-
import { n as not, r as and, t as or } from "../or-
|
|
3
|
-
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../index-
|
|
1
|
+
import { B as RetryableModelOptions, D as ResolvableLanguageModel, h as LanguageModel } from "../types-BrvhJykE.mjs";
|
|
2
|
+
import { n as not, r as and, t as or } from "../or-MbQSVByG.mjs";
|
|
3
|
+
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../index-Bo_FxEjD.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/language-model/create-retryable-model.d.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../telemetry-
|
|
2
|
-
import { t as createRetryableModel } from "../create-retryable-model-
|
|
3
|
-
import { i as or, n as and, t as not } from "../not-
|
|
4
|
-
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../conditions-
|
|
1
|
+
import "../telemetry-bNsaXZUI.mjs";
|
|
2
|
+
import { t as createRetryableModel } from "../create-retryable-model-kbZjWNJ0.mjs";
|
|
3
|
+
import { i as or, n as and, t as not } from "../not-6hBRaJRl.mjs";
|
|
4
|
+
import { a as result, i as httpStatus, n as error, o as schemaInvalid, r as finishReason, s as timeout, t as aborted } from "../conditions-DAetW5_1.mjs";
|
|
5
5
|
|
|
6
6
|
export { aborted, and, createRetryableModel, error, finishReason, httpStatus, not, or, result, schemaInvalid, timeout };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as isTimeoutError, r as isErrorAttempt, t as isAbortError } from "./guards-
|
|
1
|
+
import { d as isTimeoutError, r as isErrorAttempt, t as isAbortError } from "./guards-CKn5dl__.mjs";
|
|
2
2
|
import { n as parseRetryHeaders, t as MAX_RETRY_AFTER_MS } from "./parse-retry-headers-RPSiSNjf.mjs";
|
|
3
3
|
import { APICallError } from "ai";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as RetryContext, M as Retry, t as AnyResolvableModel, z as Retryable } from "./types-
|
|
1
|
+
import { F as RetryContext, M as Retry, t as AnyResolvableModel, z as Retryable } from "./types-BrvhJykE.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/internal/conditions/condition.d.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as ResolvableLanguageModel, E as ResolvableImageModel, V as RetryableOptions, t as AnyResolvableModel, z as Retryable } from "../types-
|
|
1
|
+
import { D as ResolvableLanguageModel, E as ResolvableImageModel, V as RetryableOptions, t as AnyResolvableModel, z as Retryable } from "../types-BrvhJykE.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/retryables/content-filter-triggered.d.ts
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as isResultAttempt, d as isTimeoutError, r as isErrorAttempt, s as isObject, u as isString } from "../guards-
|
|
1
|
+
import { c as isResultAttempt, d as isTimeoutError, r as isErrorAttempt, s as isObject, u as isString } from "../guards-CKn5dl__.mjs";
|
|
2
2
|
import { n as parseRetryHeaders, t as MAX_RETRY_AFTER_MS } from "../parse-retry-headers-RPSiSNjf.mjs";
|
|
3
3
|
import { safeParseJSON } from "@ai-sdk/provider-utils";
|
|
4
4
|
import { APICallError, NoImageGeneratedError } from "ai";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as isResultAttempt, d as isTimeoutError, o as isModel, r as isErrorAttempt, s as isObject } from "./guards-
|
|
1
|
+
import { c as isResultAttempt, d as isTimeoutError, o as isModel, r as isErrorAttempt, s as isObject } from "./guards-CKn5dl__.mjs";
|
|
2
2
|
import { RetryError, gateway } from "ai";
|
|
3
3
|
import { getErrorMessage } from "@ai-sdk/provider";
|
|
4
4
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { gateway } from "ai";
|
|
2
|
-
import {
|
|
2
|
+
import { EmbeddingModelV4, ImageModelV4, ImageModelV4CallOptions, LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamPart, SharedV4ProviderOptions } from "@ai-sdk/provider";
|
|
3
3
|
import { AttributeValue, Tracer } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
6
|
type Literals<T> = T extends string ? string extends T ? never : T : never;
|
|
7
|
-
type LanguageModel =
|
|
8
|
-
type EmbeddingModel =
|
|
9
|
-
type ImageModel =
|
|
10
|
-
type LanguageModelCallOptions =
|
|
11
|
-
type LanguageModelStreamPart =
|
|
12
|
-
type ImageModelCallOptions =
|
|
13
|
-
type ProviderOptions =
|
|
7
|
+
type LanguageModel = LanguageModelV4;
|
|
8
|
+
type EmbeddingModel = EmbeddingModelV4;
|
|
9
|
+
type ImageModel = ImageModelV4;
|
|
10
|
+
type LanguageModelCallOptions = LanguageModelV4CallOptions;
|
|
11
|
+
type LanguageModelStreamPart = LanguageModelV4StreamPart;
|
|
12
|
+
type ImageModelCallOptions = ImageModelV4CallOptions;
|
|
13
|
+
type ProviderOptions = SharedV4ProviderOptions;
|
|
14
14
|
type GatewayLanguageModelId = Parameters<(typeof gateway)['languageModel']>[0];
|
|
15
15
|
type GatewayEmbeddingModelId = Parameters<(typeof gateway)['embeddingModel']>[0];
|
|
16
16
|
type GatewayImageModelId = Parameters<(typeof gateway)['imageModel']>[0];
|
|
@@ -31,7 +31,7 @@ type ResolvedModel<MODEL extends AnyResolvableModel> = MODEL extends ResolvableL
|
|
|
31
31
|
/**
|
|
32
32
|
* Result from a generateText call.
|
|
33
33
|
*/
|
|
34
|
-
type LanguageModelResult =
|
|
34
|
+
type LanguageModelResult = LanguageModelV4GenerateResult;
|
|
35
35
|
/**
|
|
36
36
|
* Call options that can be overridden during retry for language models.
|
|
37
37
|
*/
|
|
@@ -262,7 +262,7 @@ type Retry<MODEL extends AnyResolvableModel> = {
|
|
|
262
262
|
* If both `providerOptions` and `options.providerOptions` are set,
|
|
263
263
|
* `options.providerOptions` takes precedence.
|
|
264
264
|
*/
|
|
265
|
-
providerOptions?:
|
|
265
|
+
providerOptions?: SharedV4ProviderOptions;
|
|
266
266
|
};
|
|
267
267
|
/**
|
|
268
268
|
* A function that determines whether to retry with a different model based on the current attempt and all previous attempts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-retry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Retry and fallback mechanisms for AI SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@ai-sdk/anthropic": "
|
|
38
|
-
"@ai-sdk/azure": "
|
|
39
|
-
"@ai-sdk/gateway": "
|
|
40
|
-
"@ai-sdk/google": "
|
|
41
|
-
"@ai-sdk/groq": "
|
|
42
|
-
"@ai-sdk/openai": "
|
|
43
|
-
"@ai-sdk/provider": "
|
|
44
|
-
"@ai-sdk/provider-utils": "
|
|
45
|
-
"@ai-sdk/test-server": "
|
|
37
|
+
"@ai-sdk/anthropic": "4.0.0-beta.67",
|
|
38
|
+
"@ai-sdk/azure": "4.0.0-beta.76",
|
|
39
|
+
"@ai-sdk/gateway": "4.0.0-beta.110",
|
|
40
|
+
"@ai-sdk/google": "4.0.0-beta.82",
|
|
41
|
+
"@ai-sdk/groq": "4.0.0-beta.54",
|
|
42
|
+
"@ai-sdk/openai": "4.0.0-beta.74",
|
|
43
|
+
"@ai-sdk/provider": "4.0.0-beta.19",
|
|
44
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.49",
|
|
45
|
+
"@ai-sdk/test-server": "2.0.0-beta.7",
|
|
46
46
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
47
47
|
"@langfuse/otel": "^5.3.0",
|
|
48
48
|
"@langfuse/tracing": "^5.3.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
53
53
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
54
54
|
"@types/node": "^25.0.10",
|
|
55
|
-
"ai": "
|
|
55
|
+
"ai": "7.0.0-beta.179",
|
|
56
56
|
"husky": "^9.1.7",
|
|
57
57
|
"lint-staged": "^16.4.0",
|
|
58
58
|
"msw": "^2.12.7",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"zod": "^4.3.6"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@ai-sdk/provider": "^
|
|
71
|
-
"@ai-sdk/provider-utils": "^
|
|
70
|
+
"@ai-sdk/provider": "^4.0.0-beta.0",
|
|
71
|
+
"@ai-sdk/provider-utils": "^5.0.0-beta.0",
|
|
72
72
|
"@opentelemetry/api": "^1.9.0",
|
|
73
|
-
"ai": "
|
|
73
|
+
"ai": "^7.0.0-beta.0",
|
|
74
74
|
"zod": "^4.0.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|