[GH-ISSUE #7487] Llama3.2 always returns tools calls and empty contents #4761

Closed
opened 2026-04-12 15:42:19 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ouariachi on GitHub (Nov 4, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7487

What is the issue?

When tools are included in the body of a request to the Ollama API, Llama3.2 always returns tool_calls in its response, even if the user's message does not require it.

Request

imagen_2024-11-04_044920916

Response

imagen_2024-11-04_044941389

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.3.14

Originally created by @ouariachi on GitHub (Nov 4, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7487 ### What is the issue? When tools are included in the body of a request to the Ollama API, Llama3.2 always returns tool_calls in its response, even if the user's message does not require it. ## Request ![imagen_2024-11-04_044920916](https://github.com/user-attachments/assets/c08df62b-5038-4d0c-ab0c-6a7266695552) ## Response ![imagen_2024-11-04_044941389](https://github.com/user-attachments/assets/665e4007-7bc3-412d-a21c-1fcb21f9453d) ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.3.14
GiteaMirror added the bug label 2026-04-12 15:42:19 -05:00
Author
Owner

@eust-w commented on GitHub (Nov 4, 2024):

Your request includes tools

<!-- gh-comment-id:2453818608 --> @eust-w commented on GitHub (Nov 4, 2024): Your request includes tools
Author
Owner

@ouariachi commented on GitHub (Nov 4, 2024):

I just found this code:

resp.Message.Content = sb.String()

if len(req.Tools) > 0 {
	if toolCalls, ok := m.parseToolCalls(sb.String()); ok {
		resp.Message.ToolCalls = toolCalls
		resp.Message.Content = ""
	}
}

I don't understand why the content of the response is forced to be empty if there are tools. Wouldn't it be better if the tools are only parsed when needed?

What I need is for the AI to interpret the intent of the message and parse a tool(s) if it thinks it is necessary. For example, if I tell the AI “Hello”, don't parse the tool and return a normal message. But if I tell it “What events do I have today?”, it returns the parsed “get_calendar” tool and the empty message content.

<!-- gh-comment-id:2453863754 --> @ouariachi commented on GitHub (Nov 4, 2024): I just found [this code](https://github.com/ollama/ollama/blob/18237be9b2a4f8b060b9888996a8cc8b02796290/server/routes.go#L1511): ```go resp.Message.Content = sb.String() if len(req.Tools) > 0 { if toolCalls, ok := m.parseToolCalls(sb.String()); ok { resp.Message.ToolCalls = toolCalls resp.Message.Content = "" } } ``` I don't understand why the content of the response is forced to be empty if there are tools. Wouldn't it be better if the tools are only parsed when needed? What I need is for the AI to interpret the intent of the message and parse a tool(s) if it thinks it is necessary. For example, if I tell the AI “Hello”, don't parse the tool and return a normal message. But if I tell it “What events do I have today?”, it returns the parsed “get_calendar” tool and the empty message content.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4761