[GH-ISSUE #6870] Nemotron-mini Tool Calling not using the tools API 50% of the time #30100

Closed
opened 2026-04-22 09:34:02 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @whogben on GitHub (Sep 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6870

What is the issue?

When Nemotron-mini tries to call tools, it often returns this XML wrapping a JSON tool call string, rather than triggering the Ollama tools API - see this message payload:

"message": {
    "content": " <toolcall> {\"name\": \"weather_lookup\", \"arguments\": {\n  \"temp_units\": \"celsius\",\n  \"zip_codes\": [\n    12345\n  ]\n}} </toolcall>",
    "role": "assistant"
},

However, sometimes it does use the tool calling API, (example correct payload):

"message": {
		"content": "",
		"role": "assistant",
		"tool_calls": [
			{
				"function": {
					"arguments": {
						"temp_units": "celsius",
						"zip_codes": [
							"12345"
						]
					},
					"name": "weather_lookup"
				}
			}
		]
	}

What I have noticed is that it either succeeds right away, or it gets locked into repeatedly making the unrecognized tool call indefinitely - eg, once it has it's own wrong-example in the chat history, it persists in using that format indefinitely.
I'm not sure what the recommendation would be here - normally I'd expect one should edit the template, but since it works about 50% of the time and fails about 50% of the time, I'm not sure which style to represent in the template.

OS

Windows

GPU

Nvidia

CPU

Intel

Ollama version

0.3.11

Originally created by @whogben on GitHub (Sep 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6870 ### What is the issue? When [Nemotron-mini](https://ollama.com/library/nemotron-mini) tries to call tools, it often returns this XML wrapping a JSON tool call string, rather than triggering the Ollama tools API - see this message payload: ``` "message": { "content": " <toolcall> {\"name\": \"weather_lookup\", \"arguments\": {\n \"temp_units\": \"celsius\",\n \"zip_codes\": [\n 12345\n ]\n}} </toolcall>", "role": "assistant" }, ``` However, sometimes it does use the tool calling API, (example correct payload): ``` "message": { "content": "", "role": "assistant", "tool_calls": [ { "function": { "arguments": { "temp_units": "celsius", "zip_codes": [ "12345" ] }, "name": "weather_lookup" } } ] } ``` What I have noticed is that it either succeeds right away, or it gets locked into repeatedly making the unrecognized tool call indefinitely - eg, once it has it's own wrong-example in the chat history, it persists in using that format indefinitely. I'm not sure what the recommendation would be here - normally I'd expect one should edit the template, but since it works about 50% of the time and fails about 50% of the time, I'm not sure which style to represent in the template. ### OS Windows ### GPU Nvidia ### CPU Intel ### Ollama version 0.3.11
GiteaMirror added the bug label 2026-04-22 09:34:02 -05:00
Author
Owner

@rick-github commented on GitHub (Sep 19, 2024):

What's the code you are using to make the request that responds with <toolcall>?

<!-- gh-comment-id:2359956594 --> @rick-github commented on GitHub (Sep 19, 2024): What's the code you are using to make the request that responds with `<toolcall>`?
Author
Owner

@whogben commented on GitHub (Sep 19, 2024):

Identical payload each time, I'm using the REST API and the results vary between those two examples above with no code changes. Here's the payload:

{
	"messages": [
		{
			"content": "What is the weather in Example State, zip 12345, in degrees Celsius?",
			"role": "user"
		}
	],
	"model": "nemotron-mini:latest",
	"stream": false,
	"tools": [
		{
			"function": {
				"description": "Use this tool to get the weather.",
				"name": "weather_lookup",
				"parameters": {
					"properties": {
						"temp_units": {
							"description": "What units to use for the temperature.",
							"enum": [
								"fahrenheit",
								"celsius",
								"kelvin"
							],
							"type": "string"
						},
						"zip_codes": {
							"description": "An array of zip codes to get the weather for.",
							"items": {
								"description": " A 5 digit USA zipcode string",
								"type": "string"
							},
							"type": "array"
						}
					},
					"required": [
						"zip_codes"
					],
					"type": "object"
				}
			},
			"type": "function"
		}
	]
}

(I've redacted my actual state and zip code)
I've also tested with Hermes 3 and Llama-3.1-groq-tool-calling-preview (maybe 5 tries each, both worked as usual) - so no code changes, but swapping the model does change the result.

<!-- gh-comment-id:2361370721 --> @whogben commented on GitHub (Sep 19, 2024): Identical payload each time, I'm using the REST API and the results vary between those two examples above with no code changes. Here's the payload: ``` { "messages": [ { "content": "What is the weather in Example State, zip 12345, in degrees Celsius?", "role": "user" } ], "model": "nemotron-mini:latest", "stream": false, "tools": [ { "function": { "description": "Use this tool to get the weather.", "name": "weather_lookup", "parameters": { "properties": { "temp_units": { "description": "What units to use for the temperature.", "enum": [ "fahrenheit", "celsius", "kelvin" ], "type": "string" }, "zip_codes": { "description": "An array of zip codes to get the weather for.", "items": { "description": " A 5 digit USA zipcode string", "type": "string" }, "type": "array" } }, "required": [ "zip_codes" ], "type": "object" } }, "type": "function" } ] } ``` (I've redacted my actual state and zip code) I've also tested with Hermes 3 and Llama-3.1-groq-tool-calling-preview (maybe 5 tries each, both worked as usual) - so no code changes, but swapping the model does change the result.
Author
Owner

@rick-github commented on GitHub (Sep 21, 2024):

I ran the query 200 times and apart from differences in argument quoting, it worked as expected:

$ for i in {1..200} ; do curl -s localhost:11434/api/chat -d "$(cat 6870.prompt)" | jq -c .message.tool_calls ; done | sort | uniq -c
     51 [{"function":{"name":"weather_lookup","arguments":{"temp_units":"celsius","zip_codes":["12345"]}}}]
    149 [{"function":{"name":"weather_lookup","arguments":{"temp_units":"celsius","zip_codes":[12345]}}}]

I pulled the model this morning specifically for testing, I see that the model is marked as updated yesterday, and you filed the ticket two days ago, so perhaps a model update has taken care of the issue.

<!-- gh-comment-id:2365046886 --> @rick-github commented on GitHub (Sep 21, 2024): I ran the query 200 times and apart from differences in argument quoting, it worked as expected: ```console $ for i in {1..200} ; do curl -s localhost:11434/api/chat -d "$(cat 6870.prompt)" | jq -c .message.tool_calls ; done | sort | uniq -c 51 [{"function":{"name":"weather_lookup","arguments":{"temp_units":"celsius","zip_codes":["12345"]}}}] 149 [{"function":{"name":"weather_lookup","arguments":{"temp_units":"celsius","zip_codes":[12345]}}}] ``` I pulled the model this morning specifically for testing, I see that the model is marked as updated yesterday, and you filed the ticket two days ago, so perhaps a model update has taken care of the issue.
Author
Owner

@whogben commented on GitHub (Sep 23, 2024):

Yup working for me too after I pulled the latest, thanks for testing!

<!-- gh-comment-id:2369140528 --> @whogben commented on GitHub (Sep 23, 2024): Yup working for me too after I pulled the latest, thanks for testing!
Author
Owner

@tripolskypetr commented on GitHub (Jan 2, 2025):

After the update it still spamming <toolcall> {\"type\": \"function\", \"arguments\": {\n \"name\": \"navigate_to_sales_agent_tool\"\n}} </toolcall> to the text chat instead of function execution. Please downgrade the model

<!-- gh-comment-id:2567601639 --> @tripolskypetr commented on GitHub (Jan 2, 2025): After the update it still spamming `<toolcall> {\"type\": \"function\", \"arguments\": {\n \"name\": \"navigate_to_sales_agent_tool\"\n}} </toolcall>` to the text chat instead of function execution. Please downgrade the model
Author
Owner

@rick-github commented on GitHub (Jan 2, 2025):

Example code?

<!-- gh-comment-id:2567648083 --> @rick-github commented on GitHub (Jan 2, 2025): Example code?
Author
Owner

@tripolskypetr commented on GitHub (Jan 5, 2025):

Got the steps to reproduce in https://github.com/ollama/ollama/issues/8287#issuecomment-2571758553

<!-- gh-comment-id:2571758993 --> @tripolskypetr commented on GitHub (Jan 5, 2025): Got the steps to reproduce in https://github.com/ollama/ollama/issues/8287#issuecomment-2571758553
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#30100