fix(router.py): fix router should_retry

This commit is contained in:
Krrish Dholakia 2024-04-27 15:13:20 -07:00
parent 71d63c33da
commit c70fbd0654
2 changed files with 38 additions and 20 deletions

View file

@ -1625,12 +1625,10 @@ class Router:
min_timeout=self.retry_after,
)
time.sleep(timeout)
elif (
hasattr(e, "status_code")
and hasattr(e, "response")
and litellm._should_retry(status_code=e.status_code)
elif hasattr(e, "status_code") and litellm._should_retry(
status_code=e.status_code
):
if hasattr(e.response, "headers"):
if hasattr(e, "response") and hasattr(e.response, "headers"):
timeout = litellm._calculate_retry_after(
remaining_retries=remaining_retries,
max_retries=num_retries,