From 3daa3c003d30db0ce53d5a674926a9a6e04bb196 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 8 Oct 2024 15:03:58 -0700 Subject: [PATCH] When tool selection is not done successfully with an agent, return all agent tools as options --- src/khoj/routers/helpers.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 8011d656..752115c1 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -348,11 +348,17 @@ async def aget_relevant_information_sources( final_response.append(ConversationCommand(llm_suggested_tool)) if is_none_or_empty(final_response): - final_response = [ConversationCommand.Default] + if len(agent_tools) == 0: + final_response = [ConversationCommand.Default] + else: + final_response = agent_tools return final_response except Exception as e: logger.error(f"Invalid response for determining relevant tools: {response}") - return [ConversationCommand.Default] + if len(agent_tools) == 0: + final_response = [ConversationCommand.Default] + else: + final_response = agent_tools async def aget_relevant_output_modes(