API: Fix tool_calls placement and other response compatibility issues

This commit is contained in:
oobabooga 2026-03-05 21:25:03 -08:00
parent f06583b2b9
commit d0ac58ad31
3 changed files with 6 additions and 7 deletions

View file

@ -456,11 +456,11 @@ for _ in range(10):
messages.append({
"role": "assistant",
"content": choice["message"]["content"],
"tool_calls": choice["tool_calls"],
"tool_calls": choice["message"]["tool_calls"],
})
# Execute each tool and add results to history
for tool_call in choice["tool_calls"]:
for tool_call in choice["message"]["tool_calls"]:
name = tool_call["function"]["name"]
arguments = json.loads(tool_call["function"]["arguments"])
result = execute_tool(name, arguments)