mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-12 02:45:18 +00:00
Retry on rate limit error on OpenAI calls
This commit is contained in:
parent
2f9546e144
commit
2e246869d0
1 changed files with 3 additions and 0 deletions
|
|
@ -72,6 +72,9 @@ class AiHandler:
|
||||||
except (RateLimitError) as e:
|
except (RateLimitError) as e:
|
||||||
logging.error("Rate limit error during OpenAI inference: ", e)
|
logging.error("Rate limit error during OpenAI inference: ", e)
|
||||||
raise
|
raise
|
||||||
|
except (Exception) as e:
|
||||||
|
logging.error("Unknown error during OpenAI inference: ", e)
|
||||||
|
raise TryAgain from e
|
||||||
if response is None or len(response.choices) == 0:
|
if response is None or len(response.choices) == 0:
|
||||||
raise TryAgain
|
raise TryAgain
|
||||||
resp = response.choices[0]['message']['content']
|
resp = response.choices[0]['message']['content']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue