mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
(feat) set litellm_call_id in fallbacks
This commit is contained in:
parent
b0970827d3
commit
bf5e8bd0ea
1 changed files with 2 additions and 0 deletions
|
@ -4002,6 +4002,7 @@ def completion_with_fallbacks(**kwargs):
|
||||||
fallbacks = [kwargs["model"]] + nested_kwargs.get("fallbacks", [])
|
fallbacks = [kwargs["model"]] + nested_kwargs.get("fallbacks", [])
|
||||||
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
|
||||||
|
litellm_call_id = str(uuid.uuid4())
|
||||||
|
|
||||||
# max time to process a request with fallbacks: default 45s
|
# 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:
|
||||||
|
@ -4031,6 +4032,7 @@ def completion_with_fallbacks(**kwargs):
|
||||||
del kwargs["model"]
|
del kwargs["model"]
|
||||||
|
|
||||||
print_verbose(f"trying to make completion call with model: {model}")
|
print_verbose(f"trying to make completion call with model: {model}")
|
||||||
|
kwargs["litellm_call_id"] = litellm_call_id
|
||||||
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_verbose(f"response: {response}")
|
print_verbose(f"response: {response}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue