Skip to content

Commit

Permalink
Refactor code to use consistent model configuration in groq_chat.py a…
Browse files Browse the repository at this point in the history
…nd handlers.py
  • Loading branch information
rabilrbl committed May 4, 2024
1 parent 905778b commit 5c065a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion groq_chat/groq_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def generate_response(message: str, context: ContextTypes.DEFAULT_TYPE):
response_queue = ""
for resp in chatbot.chat.completions.create(
messages=context.user_data.get("messages"),
model=context.chat_data.get("model", "llama3-8b-8192"),
model=context.user_data.get("model", "llama3-8b-8192"),
stream=True,
):
if resp.choices[0].delta.content:
Expand Down
4 changes: 2 additions & 2 deletions groq_chat/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ async def get_system_prompt(update: Update, context: ContextTypes.DEFAULT_TYPE)

async def message_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Handle messages"""
if "model" not in context.chat_data:
context.chat_data["model"] = "llama3-8b-8192"
if "model" not in context.user_data:
context.user_data["model"] = "llama3-8b-8192"

if "messages" not in context.user_data:
context.user_data["messages"] = []
Expand Down

0 comments on commit 5c065a5

Please sign in to comment.