Retry 503 OpenAI errors (#4745)

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
merwanehamadi
2023-06-19 13:20:10 -07:00
committed by GitHub
parent abb397e442
commit 3e697d5bd0

View File

@@ -97,7 +97,9 @@ def retry_openai_api(
user_warned = True
except APIError as e:
if (e.http_status not in [502, 429]) or (attempt == num_attempts):
if (e.http_status not in [429, 502, 503]) or (
attempt == num_attempts
):
raise
backoff = backoff_base ** (attempt + 2)