Skip to content

Commit

Permalink
Add list typing to the updated_messages temporary variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sabaimran committed Jan 29, 2025
1 parent 5ea056f commit c3cb608
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/khoj/processor/conversation/openai/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
from threading import Thread
from typing import Dict
from typing import Dict, List

import openai
from openai.types.chat.chat_completion import ChatCompletion
Expand Down Expand Up @@ -184,7 +184,7 @@ def llm_thread(
elif model_name.startswith("deepseek-reasoner"):
# Two successive messages cannot be from the same role. Should merge any back-to-back messages from the same role.
# The first message should always be a user message (except system message).
updated_messages = []
updated_messages: List[dict] = []
for i, message in enumerate(formatted_messages):
if i > 0 and message["role"] == formatted_messages[i - 1]["role"]:
updated_messages[-1]["content"] += " " + message["content"]
Expand Down

0 comments on commit c3cb608

Please sign in to comment.