GPTCache icon indicating copy to clipboard operation
GPTCache copied to clipboard

[Feature]: Advanced OpenAI error handling

Open alexf-a opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Bulk requests to OpenAI become difficult because of errors thrown by OpenAI due to rate limits. Errors that do not directly reflect a user's rate limit are also sometimes thrown.

If a script loops over a large amount of data and makes one request per data point, the script can crash and existing responses will be lost (costing time and money).

The two errors that I have regularly encountered are openai.error.RateLimitError and openai.error.APIConnectionError.

Describe the solution you'd like.

Automatic retries in response to openai errors. Client code should not worry at all about retry logic (timing, error handling, etc.).

Describe an alternate solution.

Cache existing responses, so that subsequent requests pick up where the script crashed.

Anything else? (Additional Context)

No response

alexf-a avatar Aug 16 '23 01:08 alexf-a

@alexf-a Thanks your suggestion, and i will try to improvement

SimFG avatar Aug 16 '23 03:08 SimFG