From 3e697d5bd07204f1e183a512531aaddde5c1aeb3 Mon Sep 17 00:00:00 2001 From: merwanehamadi Date: Mon, 19 Jun 2023 13:20:10 -0700 Subject: [PATCH] Retry 503 OpenAI errors (#4745) Signed-off-by: Merwane Hamadi --- autogpt/llm/utils/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autogpt/llm/utils/__init__.py b/autogpt/llm/utils/__init__.py index 736745cf..cd2c1c0a 100644 --- a/autogpt/llm/utils/__init__.py +++ b/autogpt/llm/utils/__init__.py @@ -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)