Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAIRetryServiceAdapter retries non-retryable errors #16

Closed
phelps-sg opened this issue Jun 9, 2023 · 2 comments
Closed

OpenAIRetryServiceAdapter retries non-retryable errors #16

phelps-sg opened this issue Jun 9, 2023 · 2 comments

Comments

@phelps-sg
Copy link
Contributor

Currently OpenAIRetryServiceAdapter retries all errors except OpenAIScalaTokenCountExceededException. However, there are many other errors returned by the API that should not be retried, e.g. 401 and 402 (https://platform.openai.com/docs/guides/error-codes/api-errors).

I think in general it is only 429 errors that should be retried. Relevant OpenAI docs quoted below. See also #9.

429 - Rate limit reached for requests Cause: You are sending requests too quickly. Solution: Pace your requests. Read the Rate limit guide.
429 - You exceeded your current quota, please check your plan and billing details Cause: You have hit your maximum monthly spend (hard limit) which you can view in the account billing section. Solution: Apply for a quota increase.
429 - The engine is currently overloaded, please try again later Cause: Our servers are experiencing high traffic. Solution: Please retry your requests after a brief wait.

429 - Rate limit reached for requests Cause: You are sending requests too quickly.
Solution: Pace your requests. Read the Rate limit guide.
429 - You exceeded your current quota, please check your plan and billing details Cause: You have hit your maximum monthly spend (hard limit) which you can view in the account billing section.
Solution: Apply for a quota increase.
429 - The engine is currently overloaded, please try again later Cause: Our servers are experiencing high traffic.
Solution: Please retry your requests after a brief wait.

@peterbanda
Copy link
Member

Hey @phelps-sg,

Very nice summary. Thanks for the feedback! Will check the error codes and apply retry only on the relevant ones (will need new exceptions).

Cheers

phelps-sg added a commit to phelps-sg/openai-scala-client that referenced this issue Jun 9, 2023
@phelps-sg
Copy link
Contributor Author

Many thanks! Have submitted an initial unit test for OpenAIRetryServiceAdapter in PR #18 in case it is useful.

phelps-sg added a commit to phelps-sg/openai-scala-client that referenced this issue Jun 10, 2023
phelps-sg added a commit to phelps-sg/openai-scala-client that referenced this issue Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants