Skip to content

Commit

Permalink
fix: do not hardcode glm model (#547)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming authored Sep 22, 2024
1 parent 011637e commit 915d674
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 1 addition & 5 deletions xiaogpt/bot/glm_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

class GLMBot(ChatHistoryMixin, BaseBot):
name = "Chat GLM"
default_options = {"model": "chatglm_turbo"}
default_options = {"model": "glm-4"} # Change glm model here

def __init__(self, glm_key: str) -> None:
from zhipuai import ZhipuAI

self.model = "glm-4" # Change glm model here

self.history = []
self.client = ZhipuAI(api_key=glm_key)

Expand All @@ -28,7 +26,6 @@ def from_config(cls, config):
def ask(self, query, **options):
ms = self.get_messages()
kwargs = {**self.default_options, **options}
kwargs["model"] = self.model
ms.append({"role": "user", "content": f"{query}"})
kwargs["messages"] = ms
try:
Expand All @@ -45,7 +42,6 @@ def ask(self, query, **options):
async def ask_stream(self, query: str, **options: Any):
ms = self.get_messages()
kwargs = {**self.default_options, **options}
kwargs["model"] = self.model
ms.append({"role": "user", "content": f"{query}"})
kwargs["messages"] = ms
kwargs["stream"] = True
Expand Down
1 change: 0 additions & 1 deletion xiaogpt/bot/qwen_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class QwenBot(ChatHistoryMixin, BaseBot):

def __init__(self, qwen_key: str) -> None:
import dashscope
from dashscope.api_entities.dashscope_response import Role

self.history = []
dashscope.api_key = qwen_key
Expand Down

0 comments on commit 915d674

Please sign in to comment.