fix anthropic tool result format (#2246)

This commit is contained in:
Shuchang Zheng
2025-04-29 04:17:50 +08:00
committed by GitHub
parent 2f10e3c430
commit f4ea546ae4
4 changed files with 15 additions and 4 deletions

View File

@@ -1405,9 +1405,19 @@ class ForgeAgent:
scraped_page: ScrapedPage,
llm_caller: LLMCaller,
) -> list[Action]:
LOG.info(
"Anthropic CU call starts",
tool_results=llm_caller.current_tool_results,
message_length=len(llm_caller.message_history),
)
if llm_caller.current_tool_results:
llm_caller.message_history.append({"role": "user", "content": llm_caller.current_tool_results})
llm_caller.clear_tool_results()
LOG.info(
"Anthropic CU call - appended tool result message to message history and cleared cached tool results",
message=llm_caller.current_tool_results,
message_length=len(llm_caller.message_history),
)
tools = [
{
"type": "computer_20250124",