From fe246aecbbf83426dab3596c1b1e602c055cd0e1 Mon Sep 17 00:00:00 2001 From: Weves Date: Tue, 4 Mar 2025 18:12:32 -0800 Subject: [PATCH] Attempt to address tool happy claude --- .../agent_search/orchestration/nodes/choose_tool.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/onyx/agents/agent_search/orchestration/nodes/choose_tool.py b/backend/onyx/agents/agent_search/orchestration/nodes/choose_tool.py index f7fdd71e5..59094d12e 100644 --- a/backend/onyx/agents/agent_search/orchestration/nodes/choose_tool.py +++ b/backend/onyx/agents/agent_search/orchestration/nodes/choose_tool.py @@ -98,8 +98,16 @@ def choose_tool( # For tool calling LLMs, we want to insert the task prompt as part of this flow, this is because the LLM # may choose to not call any tools and just generate the answer, in which case the task prompt is needed. prompt=built_prompt, - tools=[tool.tool_definition() for tool in tools] or None, - tool_choice=("required" if tools and force_use_tool.force_use else None), + tools=( + [tool.tool_definition() for tool in tools] or None + if using_tool_calling_llm + else None + ), + tool_choice=( + "required" + if tools and force_use_tool.force_use and using_tool_calling_llm + else None + ), structured_response_format=structured_response_format, )