diff --git a/src/backend/base/langflow/components/deactivated/ChatLiteLLMModel.py b/src/backend/base/langflow/components/deactivated/ChatLiteLLMModel.py index 8711f6d2ffbd..52c927e6d824 100644 --- a/src/backend/base/langflow/components/deactivated/ChatLiteLLMModel.py +++ b/src/backend/base/langflow/components/deactivated/ChatLiteLLMModel.py @@ -128,10 +128,14 @@ def build_model(self) -> LanguageModel: raise ChatLiteLLMException( "Could not import litellm python package. " "Please install it with `pip install litellm`" ) - - # Set the API key based on the provider - self.kwargs[self.provider] = self.api_key - self.model_kwargs["api_key"] = self.api_key + # Remove empty keys + if "" in self.kwargs: + del self.kwargs[""] + if "" in self.model_kwargs: + del self.model_kwargs[""] + # Set the API key + # self.model_kwargs["api_key"] = self.api_key + # Report missing fields for Azure provider if self.provider == "Azure": if "api_base" not in self.kwargs: raise Exception("Missing api_base on kwargs") @@ -150,5 +154,6 @@ def build_model(self) -> LanguageModel: max_retries=self.max_retries, **self.kwargs, ) + llm.client.api_key = self.api_key return llm