Handle OpenAI API rate limit errors
Error example:
2023-12-13 08:30:27 INFO openai error_code=rate_limit_exceeded error_message='Rate limit reached for gpt-4 in organization org-soPGsUh33dTeT4s4Yxm98Cnc on tokens_usage_based per min: Limit 10000, Used 8782, Requested 8172. Please try again in 41.724s. Visit https://platform.openai.com/account/rate-limits to learn more.' error_param=None error_type=tokens_usage_based message='OpenAI API error received' stream_error=False
2023-12-13 08:30:27 WARNING wally [Todo 92500] A retryable OpenAI error occurred: Rate limit reached for gpt-4 in organization org-soPGsUh33dTeT4s4Yxm98Cnc on tokens_usage_based per min: Limit 10000, Used 8782, Requested 8172. Please try again in 41.724s. Visit https://platform.openai.com/account/rate-limits to learn more.
OpenAI documentation: https://platform.openai.com/account/limits
Edited by Jean-Marc Le Roux