forked from phoenix/litellm-mirror
check num retries in async wrapper
This commit is contained in:
parent
bd95626579
commit
c365de122a
1 changed files with 10 additions and 0 deletions
|
@ -2515,6 +2515,16 @@ def client(original_function):
|
|||
or kwargs.get("atext_completion", False) == True
|
||||
or kwargs.get("atranscription", False) == True
|
||||
):
|
||||
# [OPTIONAL] CHECK MAX RETRIES / REQUEST
|
||||
if litellm.num_retries_per_request is not None:
|
||||
# check if previous_models passed in as ['litellm_params']['metadata]['previous_models']
|
||||
previous_models = kwargs.get("metadata", {}).get(
|
||||
"previous_models", None
|
||||
)
|
||||
if previous_models is not None:
|
||||
if litellm.num_retries_per_request <= len(previous_models):
|
||||
raise Exception(f"Max retries per request hit!")
|
||||
|
||||
# MODEL CALL
|
||||
result = original_function(*args, **kwargs)
|
||||
if "stream" in kwargs and kwargs["stream"] == True:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue