fix: Handle empty status codes in litellm retry decorator

This commit is contained in:
Paul Gauthier 2024-08-01 18:28:41 -03:00
parent 9c29eaf776
commit 4a42a07237

View file

@ -29,6 +29,14 @@ def lazy_litellm_retry_decorator(func):
):
return False
# These seem to return .status_code = ""
# litellm._should_retry() expects an int and throws a TypeError
#
# litellm.llms.anthropic.AnthropicError
# litellm.exceptions.APIError
if not e.status_code:
return False
return not litellm._should_retry(e.status_code)
decorated_func = backoff.on_exception(