From 0590ec620b311f42936b01db70ca9ad11f01dc73 Mon Sep 17 00:00:00 2001 From: mc-marcocheng <57459045+mc-marcocheng@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:02:15 +0800 Subject: [PATCH] Fix data being overwritten --- litellm/router.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index a1f9fcfc7..796cbb985 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -61,10 +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) + return litellm.completion(**{**data, **kwargs}) def text_completion(self, model: str, @@ -80,10 +78,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) + return litellm.text_completion(**{**data, **kwargs}) def embedding(self, model: str, @@ -96,7 +92,7 @@ class Router: data = deployment["litellm_params"] data["input"] = input # call via litellm.embedding() - return litellm.embedding(**data) + return litellm.embedding(**{**data, **kwargs}) def set_model_list(self, model_list: list): self.model_list = model_list