[GH-ISSUE #12174] tool_calls missing from qwen2.5-coder v0.11.7 (also v0.11.8) #70156

Open
opened 2026-05-04 20:33:18 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @ldab on GitHub (Sep 3, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12174

What is the issue?

When requesting ie.

{
    "model": "qwen2.5-coder",
    "stream": false,
    "temperature": 0.2,
    "seed": -1183861426,
    "messages": [
        {
            "role": "system",
            "content": "Act as a PatchSet Reviewer."
        },
        {
            "role": "user",
            "content": "Why not use malloc and not free data?"
        }
    ],
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "format_replies",
                "description": "Provide the PatchSet review replies.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "replies": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer"
                                    },
                                    "reply": {
                                        "type": "string"
                                    },
                                    "score": {
                                        "type": "integer"
                                    },
                                    "relevance": {
                                        "type": "number"
                                    },
                                    "repeated": {
                                        "type": "boolean"
                                    },
                                    "conflicting": {
                                        "type": "boolean"
                                    },
                                    "filename": {
                                        "type": "string"
                                    },
                                    "lineNumber": {
                                        "type": "integer"
                                    },
                                    "codeSnippet": {
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "reply"
                                ]
                            }
                        },
                        "changeId": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "replies",
                        "changeId"
                    ]
                }
            }
        }
    ],
    "tool_choice": {
        "type": "function",
        "function": {
            "name": "format_replies"
        }
    }
}

The response does not contains "tool_calls"

{
    "id": "chatcmpl-9",
    "object": "chat.completion",
    "created": 1756934212,
    "model": "qwen2.5-coder",
    "system_fingerprint": "fp_ollama",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "{\"name\": \"format_replies\", \"arguments\": {\"changeId\": \"I1234567890abcdef1234567890abcdef1234567\", \"replies\": [{\"filename\": \"example.c\", \"lineNumber\": 10, \"reply\": \"Using malloc without freeing the allocated memory can lead to memory leaks. It's important to ensure that every call to malloc is paired with a corresponding call to free.\", \"score\": 2}]}}"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 252,
        "completion_tokens": 110,
        "total_tokens": 362
    }
}

Whereas when using qwen2.5 it seems fine, did I miss something?

Relevant log output


OS

Debian 12

GPU

No response

CPU

No response

Ollama version

v0.11.7

Originally created by @ldab on GitHub (Sep 3, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12174 ### What is the issue? When requesting ie. ``` { "model": "qwen2.5-coder", "stream": false, "temperature": 0.2, "seed": -1183861426, "messages": [ { "role": "system", "content": "Act as a PatchSet Reviewer." }, { "role": "user", "content": "Why not use malloc and not free data?" } ], "tools": [ { "type": "function", "function": { "name": "format_replies", "description": "Provide the PatchSet review replies.", "parameters": { "type": "object", "properties": { "replies": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "reply": { "type": "string" }, "score": { "type": "integer" }, "relevance": { "type": "number" }, "repeated": { "type": "boolean" }, "conflicting": { "type": "boolean" }, "filename": { "type": "string" }, "lineNumber": { "type": "integer" }, "codeSnippet": { "type": "string" } }, "required": [ "reply" ] } }, "changeId": { "type": "string" } }, "required": [ "replies", "changeId" ] } } } ], "tool_choice": { "type": "function", "function": { "name": "format_replies" } } } ``` The response does not contains "tool_calls" ``` { "id": "chatcmpl-9", "object": "chat.completion", "created": 1756934212, "model": "qwen2.5-coder", "system_fingerprint": "fp_ollama", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "{\"name\": \"format_replies\", \"arguments\": {\"changeId\": \"I1234567890abcdef1234567890abcdef1234567\", \"replies\": [{\"filename\": \"example.c\", \"lineNumber\": 10, \"reply\": \"Using malloc without freeing the allocated memory can lead to memory leaks. It's important to ensure that every call to malloc is paired with a corresponding call to free.\", \"score\": 2}]}}" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 252, "completion_tokens": 110, "total_tokens": 362 } } ``` Whereas when using `qwen2.5` it seems fine, did I miss something? ### Relevant log output ```shell ``` ### OS Debian 12 ### GPU _No response_ ### CPU _No response_ ### Ollama version v0.11.7
GiteaMirror added the bug label 2026-05-04 20:33:19 -05:00
Author
Owner

@neurostream commented on GitHub (Sep 4, 2025):

@ldab Did previous releases of qwen2.5-coder support tool use - and this issue ( #12174 ) is calling out that something changed?

Interesting that the coder variation of the qwen3 models was split off from the rest on ollama.com without tool use as well ( #11621 ).

<!-- gh-comment-id:3251983289 --> @neurostream commented on GitHub (Sep 4, 2025): @ldab Did previous releases of qwen2.5-coder support tool use - and this issue ( #12174 ) is calling out that something changed? Interesting that the coder variation of the qwen3 models was split off from the rest on ollama.com without tool use as well ( #11621 ).
Author
Owner

@ldab commented on GitHub (Sep 4, 2025):

This is my first usage of this model, I don’t know if previous releases included the field, I can see on the template tho :/

I think I also saw some differences between qwen2.5 7b and 14b… if I remember right the 7b also missed tool_calls

<!-- gh-comment-id:3252019322 --> @ldab commented on GitHub (Sep 4, 2025): This is my first usage of this model, I don’t know if previous releases included the field, I can see on the template tho :/ I think I also saw some differences between qwen2.5 7b and 14b… if I remember right the 7b also missed tool_calls
Author
Owner

@ninthhousestudios commented on GitHub (Apr 15, 2026):

Reproducing this on ollama 0.20.7 with qwen2.5-coder:14b — same failure: model emits bare JSON in content, tool_calls is null.

Additional data points that narrow the cause:

  1. The same pipeline works for qwen3:8b — confirms the OAI shim and tool routing are fine. Only the coder variant fails.

    # qwen3:8b  →  OK
    tool_calls: [{'function': {'name': 'calculator', 'arguments': '{"expr":"17 * 23"}'}}]
    
    # qwen2.5-coder:14b  →  broken
    tool_calls: None
    content: {"name": "calculator", "arguments": {"expr": "17 * 23"}}
    
  2. Native /api/chat endpoint fails identically — not OAI-shim-specific.

    curl http://127.0.0.1:11434/api/chat -d '{"model":"qwen2.5-coder:14b","tools":[...],"messages":[...]}'
    # tool_calls: null, content: bare JSON
    
  3. The template explicitly instructs the model to use <tool_call> tags:

    For each function call, return a json object with function name and arguments within <tool_call></tool_call> with NO other text.

    But the model consistently outputs bare JSON without the tags, so the parser can't recognize it as a tool call.

Likely root cause: the template shipped with qwen2.5-coder assumes the same tool-call format as base qwen2.5, but the coder variant appears to have been trained on a different (or weaker) tool-call distribution and doesn't reliably produce the expected <tool_call> wrappers. Either the template needs adjustment to match the model's actual output, or the tools capability flag should be demoted / removed for this model so downstream frameworks (Goose, opencode, etc.) don't assume tool support that won't work reliably.

Related: #13968 (closed) reports the same symptom on qwen2.5:14b base.

Happy to test any proposed fix on the 14B coder variant.

<!-- gh-comment-id:4254002185 --> @ninthhousestudios commented on GitHub (Apr 15, 2026): Reproducing this on **ollama 0.20.7** with `qwen2.5-coder:14b` — same failure: model emits bare JSON in `content`, `tool_calls` is `null`. **Additional data points that narrow the cause:** 1. **The same pipeline works for `qwen3:8b`** — confirms the OAI shim and tool routing are fine. Only the coder variant fails. ``` # qwen3:8b → OK tool_calls: [{'function': {'name': 'calculator', 'arguments': '{"expr":"17 * 23"}'}}] # qwen2.5-coder:14b → broken tool_calls: None content: {"name": "calculator", "arguments": {"expr": "17 * 23"}} ``` 2. **Native `/api/chat` endpoint fails identically** — not OAI-shim-specific. ```bash curl http://127.0.0.1:11434/api/chat -d '{"model":"qwen2.5-coder:14b","tools":[...],"messages":[...]}' # tool_calls: null, content: bare JSON ``` 3. **The template explicitly instructs the model to use `<tool_call>` tags:** > For each function call, return a json object with function name and arguments within `<tool_call></tool_call>` with NO other text. But the model consistently outputs bare JSON without the tags, so the parser can't recognize it as a tool call. **Likely root cause:** the template shipped with `qwen2.5-coder` assumes the same tool-call format as base `qwen2.5`, but the coder variant appears to have been trained on a different (or weaker) tool-call distribution and doesn't reliably produce the expected `<tool_call>` wrappers. Either the template needs adjustment to match the model's actual output, or the `tools` capability flag should be demoted / removed for this model so downstream frameworks (Goose, opencode, etc.) don't assume tool support that won't work reliably. Related: #13968 (closed) reports the same symptom on `qwen2.5:14b` base. Happy to test any proposed fix on the 14B coder variant.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#70156