From fd8644d040c76fb24243e94af7f9849f36729f1c Mon Sep 17 00:00:00 2001 From: "Richard Kuo (Danswer)" Date: Wed, 9 Oct 2024 14:02:52 -0700 Subject: [PATCH] backport Update litellm to fix bedrock models (#2649) --- backend/danswer/llm/chat_llm.py | 10 ++++++---- backend/requirements/default.txt | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/danswer/llm/chat_llm.py b/backend/danswer/llm/chat_llm.py index 08131f581..274e0006c 100644 --- a/backend/danswer/llm/chat_llm.py +++ b/backend/danswer/llm/chat_llm.py @@ -290,10 +290,12 @@ class DefaultMultiLLM(LLM): return litellm.completion( # model choice model=f"{self.config.model_provider}/{self.config.model_name}", - api_key=self._api_key, - base_url=self._api_base, - api_version=self._api_version, - custom_llm_provider=self._custom_llm_provider, + # NOTE: have to pass in None instead of empty string for these + # otherwise litellm can have some issues with bedrock + api_key=self._api_key or None, + base_url=self._api_base or None, + api_version=self._api_version or None, + custom_llm_provider=self._custom_llm_provider or None, # actual input messages=prompt, tools=tools, diff --git a/backend/requirements/default.txt b/backend/requirements/default.txt index f606fae20..2b7da8b84 100644 --- a/backend/requirements/default.txt +++ b/backend/requirements/default.txt @@ -28,7 +28,7 @@ jsonref==1.1.0 langchain==0.1.17 langchain-core==0.1.50 langchain-text-splitters==0.0.1 -litellm==1.47.1 +litellm==1.48.7 llama-index==0.9.45 Mako==1.2.4 msal==1.28.0