Skip to content

Commit

Permalink
Retry 503 OpenAI errors
Browse files Browse the repository at this point in the history
Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
  • Loading branch information
waynehamadi committed Jun 19, 2023
1 parent abb397e commit 1fead30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autogpt/llm/utils/__init__.py
Expand Up @@ -97,7 +97,9 @@ def _wrapped(*args, **kwargs):
user_warned = True

Check warning on line 97 in autogpt/llm/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

autogpt/llm/utils/__init__.py#L96-L97

Added lines #L96 - L97 were not covered by tests

except APIError as e:

Check warning on line 99 in autogpt/llm/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

autogpt/llm/utils/__init__.py#L99

Added line #L99 was not covered by tests
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

Check warning on line 103 in autogpt/llm/utils/__init__.py

View check run for this annotation

Codecov / codecov/patch

autogpt/llm/utils/__init__.py#L103

Added line #L103 was not covered by tests

backoff = backoff_base ** (attempt + 2)
Expand Down

0 comments on commit 1fead30

Please sign in to comment.