From 4274f58dbdd17bf4428459c89c7b3ef74a435f4b Mon Sep 17 00:00:00 2001 From: Debanjum Date: Fri, 15 Aug 2025 14:17:35 -0700 Subject: [PATCH] Show more specific warning to llm on duplicate tool use during research --- src/khoj/routers/research.py | 2 +- src/khoj/utils/helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/khoj/routers/research.py b/src/khoj/routers/research.py index dbb1da75..84562d46 100644 --- a/src/khoj/routers/research.py +++ b/src/khoj/routers/research.py @@ -197,7 +197,7 @@ async def apick_next_tool( if i.warning is None and isinstance(i.query, ToolCall) } if (parsed_response.name, dict_to_tuple(parsed_response.args)) in previous_tool_query_combinations: - warning = "Repeated tool, query combination detected. Skipping iteration. Try something different." + warning = f"Repeated tool, query combination detected. You've already called {parsed_response.name} with args: {parsed_response.args}. Try something different." # Only send client status updates if we'll execute this iteration and model has thoughts to share. elif send_status_func and not is_none_or_empty(response.thought): async for event in send_status_func(response.thought): diff --git a/src/khoj/utils/helpers.py b/src/khoj/utils/helpers.py index 339dbb67..f8e5a07c 100644 --- a/src/khoj/utils/helpers.py +++ b/src/khoj/utils/helpers.py @@ -588,7 +588,7 @@ tools_for_research_llm = { description=dedent( """ To have the tool AI semantic search through the user's knowledge base. - Helpful to answer questions for which finding some relevant notes or documents can complete the search. Example: "When was Tom born?" + Helpful to answer questions for which finding some relevant notes or documents can be useful. Example: "When was Tom born?" This tool AI cannot find all relevant notes or documents, only a subset of them. It is a good starting point to find keywords, discover similar topics or related concepts and some relevant notes or documents. For a given query, the tool AI can perform a maximum of {max_search_queries} semantic search subqueries per iteration.