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)
This commit is contained in:
Kevin Hu 2024-10-29 10:42:45 +08:00 committed by GitHub
parent f86826b7a0
commit 7e0148c058
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,6 +109,8 @@ class XinferenceChat(Base):
if base_url.split("/")[-1] != "v1": if base_url.split("/")[-1] != "v1":
base_url = os.path.join(base_url, "v1") base_url = os.path.join(base_url, "v1")
super().__init__(key, model_name, base_url) super().__init__(key, model_name, base_url)
class HuggingFaceChat(Base): class HuggingFaceChat(Base):
def __init__(self, key=None, model_name="", base_url=""): def __init__(self, key=None, model_name="", base_url=""):
if not base_url: if not base_url:
@ -117,6 +119,7 @@ class HuggingFaceChat(Base):
base_url = os.path.join(base_url, "v1") base_url = os.path.join(base_url, "v1")
super().__init__(key, model_name, base_url) super().__init__(key, model_name, base_url)
class DeepSeekChat(Base): class DeepSeekChat(Base):
def __init__(self, key, model_name="deepseek-chat", base_url="https://api.deepseek.com/v1"): 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" 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: if "max_tokens" not in gen_conf:
gen_conf["max_tokens"] = 4096 gen_conf["max_tokens"] = 4096
ans = ""
try: try:
response = self.client.messages.create( response = self.client.messages.create(
model=self.model_name, model=self.model_name,