debug: log message state when checking for tool calls

This commit is contained in:
2026-02-24 13:08:58 +01:00
parent fb8565cd73
commit e3eb52d285
+6
View File
@@ -67,6 +67,12 @@ def format_messages_with_tools(messages: list, tools: Optional[list] = None) ->
for msg in messages
)
# Debug: log what we're checking
if tools:
print(f"DEBUG TOOLS: has_tool_results={has_tool_results}, has_tool_calls={has_tool_calls}, has_tool_calls_in_content={has_tool_calls_in_content}")
for i, msg in enumerate(messages):
print(f" [{i}] {msg.role}: content={repr(msg.content)[:50] if msg.content else None}, tool_calls={msg.tool_calls is not None and len(msg.tool_calls) > 0 if hasattr(msg, 'tool_calls') else False}")
# Add tool instructions if tools are present and no tool results/calls yet
if tools and not has_tool_results and not has_tool_calls and not has_tool_calls_in_content:
tool_instructions = """You have access to tools. When asked to create, write, or modify files, USE the tools.