From b6aa77a6f5b3c22c2520cb41b16bd8369266d667 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Thu, 29 May 2025 11:23:01 -0700 Subject: [PATCH] Lookback 3 previous turns to select next tool, for questions history --- src/khoj/processor/conversation/utils.py | 2 +- src/khoj/routers/helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/khoj/processor/conversation/utils.py b/src/khoj/processor/conversation/utils.py index 63cca547..039b745f 100644 --- a/src/khoj/processor/conversation/utils.py +++ b/src/khoj/processor/conversation/utils.py @@ -221,7 +221,7 @@ def construct_chat_history(conversation_history: dict, n: int = 4, agent_name="A def construct_question_history( conversation_log: dict, include_query: bool = True, - lookback: int = 4, + lookback: int = 6, query_prefix: str = "Q", agent_name: str = "Khoj", ) -> str: diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index a3322b67..28b15f3c 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -386,7 +386,7 @@ async def aget_data_sources_and_output_format( if len(agent_outputs) == 0 or output.value in agent_outputs: output_options_str += f'- "{output.value}": "{description}"\n' - chat_history = construct_chat_history(conversation_history) + chat_history = construct_chat_history(conversation_history, n=6) if query_images: query = f"[placeholder for {len(query_images)} user attached images]\n{query}"