fix(router.py): enable additional params to be passe din

This commit is contained in:
Krrish Dholakia 2023-10-23 20:41:18 -07:00
parent c4b550cfda
commit 05740fed9d
2 changed files with 98 additions and 43 deletions

View file

@ -61,6 +61,8 @@ class Router:
data = deployment["litellm_params"]
data["messages"] = messages
for key, value in kwargs.items():
data[key] = value
# call via litellm.completion()
return litellm.completion(**data)
@ -78,6 +80,8 @@ class Router:
data = deployment["litellm_params"]
data["prompt"] = prompt
for key, value in kwargs.items():
data[key] = value
# call via litellm.completion()
return litellm.text_completion(**data)
@ -203,7 +207,10 @@ class Router:
# get value
cached_value = self.cache.get_cache(key)
# update value
cached_value = cached_value + increment_value
try:
cached_value = cached_value + increment_value
except:
cached_value = increment_value
# save updated value
self.cache.add_cache(result=cached_value, cache_key=key)