-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Retry model provider throttling
- Loading branch information
1 parent
94c0364
commit 871b52c
Showing
3 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { isRetryableError, RetryableError } from "./errors"; | ||
import { RateLimitError } from "@anthropic-ai/sdk"; | ||
|
||
describe("isRetryableError", () => { | ||
it("should return true for retryable errors", async () => { | ||
expect(isRetryableError(new Error())).toBe(false); | ||
|
||
expect(isRetryableError(new RateLimitError(429, new Error(), "", {}))).toBe(true); | ||
expect(isRetryableError(new RetryableError(""))).toBe(true); | ||
|
||
|
||
expect(isRetryableError(new Error("429 Too many requests, please wait before trying again."))).toBe(true); | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters