From 7e0148c058c7814862467e990fe9bd4be5eab0d1 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 29 Oct 2024 10:42:45 +0800 Subject: [PATCH] fix local variable ans (#3077) ### What problem does this PR solve? #3064 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/llm/chat_model.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rag/llm/chat_model.py b/rag/llm/chat_model.py index b9b0fa812..ebc48954c 100644 --- a/rag/llm/chat_model.py +++ b/rag/llm/chat_model.py @@ -109,6 +109,8 @@ class XinferenceChat(Base): if base_url.split("/")[-1] != "v1": base_url = os.path.join(base_url, "v1") super().__init__(key, model_name, base_url) + + class HuggingFaceChat(Base): def __init__(self, key=None, model_name="", base_url=""): if not base_url: @@ -117,6 +119,7 @@ class HuggingFaceChat(Base): base_url = os.path.join(base_url, "v1") super().__init__(key, model_name, base_url) + class DeepSeekChat(Base): def __init__(self, key, model_name="deepseek-chat", base_url="https://api.deepseek.com/v1"): if not base_url: base_url = "https://api.deepseek.com/v1" @@ -1247,6 +1250,7 @@ class AnthropicChat(Base): if "max_tokens" not in gen_conf: gen_conf["max_tokens"] = 4096 + ans = "" try: response = self.client.messages.create( model=self.model_name,