mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
(fix) remove print statements from completion fallbacks, make them print verbose
This commit is contained in:
parent
effd08f597
commit
a88ed12a9a
1 changed files with 3 additions and 3 deletions
|
@ -4060,7 +4060,6 @@ def completion_with_split_tests(models={}, messages=[], use_client=False, overri
|
||||||
return litellm.completion(model=selected_llm, messages=messages, use_client=use_client, **kwargs)
|
return litellm.completion(model=selected_llm, messages=messages, use_client=use_client, **kwargs)
|
||||||
|
|
||||||
def completion_with_fallbacks(**kwargs):
|
def completion_with_fallbacks(**kwargs):
|
||||||
print(f"kwargs inside completion_with_fallbacks: {kwargs}")
|
|
||||||
nested_kwargs = kwargs.pop("kwargs", {})
|
nested_kwargs = kwargs.pop("kwargs", {})
|
||||||
response = None
|
response = None
|
||||||
rate_limited_models = set()
|
rate_limited_models = set()
|
||||||
|
@ -4071,6 +4070,7 @@ def completion_with_fallbacks(**kwargs):
|
||||||
if "fallbacks" in nested_kwargs:
|
if "fallbacks" in nested_kwargs:
|
||||||
del nested_kwargs["fallbacks"] # remove fallbacks so it's not recursive
|
del nested_kwargs["fallbacks"] # remove fallbacks so it's not recursive
|
||||||
|
|
||||||
|
# max time to process a request with fallbacks: default 45s
|
||||||
while response == None and time.time() - start_time < 45:
|
while response == None and time.time() - start_time < 45:
|
||||||
for model in fallbacks:
|
for model in fallbacks:
|
||||||
# loop thru all models
|
# loop thru all models
|
||||||
|
@ -4097,10 +4097,10 @@ def completion_with_fallbacks(**kwargs):
|
||||||
if kwargs.get("model"):
|
if kwargs.get("model"):
|
||||||
del kwargs["model"]
|
del kwargs["model"]
|
||||||
|
|
||||||
print(f"trying to make completion call with model: {model}")
|
print_verbose(f"trying to make completion call with model: {model}")
|
||||||
kwargs = {**kwargs, **nested_kwargs} # combine the openai + litellm params at the same level
|
kwargs = {**kwargs, **nested_kwargs} # combine the openai + litellm params at the same level
|
||||||
response = litellm.completion(**kwargs, model=model)
|
response = litellm.completion(**kwargs, model=model)
|
||||||
print(f"response: {response}")
|
print_verbose(f"response: {response}")
|
||||||
if response != None:
|
if response != None:
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue