mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
router - clean up should_retry_this_error
This commit is contained in:
parent
6a967b3267
commit
9ca793fffd
1 changed files with 9 additions and 5 deletions
|
@ -1594,17 +1594,21 @@ class Router:
|
|||
_num_healthy_deployments = 0
|
||||
if healthy_deployments is not None and isinstance(healthy_deployments, list):
|
||||
_num_healthy_deployments = len(healthy_deployments)
|
||||
|
||||
### CHECK IF RATE LIMIT / CONTEXT WINDOW ERROR w/ fallbacks available / Bad Request Error
|
||||
|
||||
if (
|
||||
isinstance(error, litellm.ContextWindowExceededError)
|
||||
and context_window_fallbacks is not None
|
||||
) or (
|
||||
isinstance(error, openai.RateLimitError)
|
||||
and fallbacks is not None
|
||||
and _num_healthy_deployments <= 0
|
||||
and context_window_fallbacks is None
|
||||
):
|
||||
raise error
|
||||
|
||||
if isinstance(error, openai.RateLimitError):
|
||||
if fallbacks is None and _num_healthy_deployments <= 0:
|
||||
raise error
|
||||
|
||||
return True
|
||||
|
||||
def function_with_fallbacks(self, *args, **kwargs):
|
||||
"""
|
||||
Try calling the function_with_retries
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue