[GH-ISSUE #11147] Tool calling broken in 0.9.2 #7351

Closed
opened 2026-04-12 19:24:14 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @du291 on GitHub (Jun 20, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11147

What is the issue?

Tool calls appear as json content in messages, since upgrade from 0.9.0 to 0.9.2.

Relevant log output

test command:

http -v -j POST 127.0.0.1:11434/api/chat --raw='{"model":"qwen3:30b-a3b","stream":false,"format":"json","messages":[{"role":"user", "content":"press the button"}],"tools":[{"type":"function","function":{"name":"press_button","description":"press the button","parameters":{"type":"object"}}}],"think":false}'

0.9.0:

POST /api/chat HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, zstd
Connection: keep-alive
Content-Length: 258
Content-Type: application/json
Host: 127.0.0.1:11434
User-Agent: HTTPie/3.2.4

{
    "format": "json",
    "messages": [
        {
            "content": "press the button",
            "role": "user"
        }
    ],
    "model": "qwen3:30b-a3b",
    "stream": false,
    "think": false,
    "tools": [
        {
            "function": {
                "description": "press the button",
                "name": "press_button",
                "parameters": {
                    "type": "object"
                }
            },
            "type": "function"
        }
    ]
}


HTTP/1.1 200 OK
Content-Length: 370
Content-Type: application/json; charset=utf-8
Date: Fri, 20 Jun 2025 17:41:10 GMT

{
    "created_at": "2025-06-20T17:41:10.671386126Z",
    "done": true,
    "done_reason": "stop",
    "eval_count": 13,
    "eval_duration": 571054871,
    "load_duration": 1710981976,
    "message": {
        "content": "",
        "role": "assistant",
        "tool_calls": [
            {
                "function": {
                    "arguments": {},
                    "name": "press_button"
                }
            }
        ]
    },
    "model": "qwen3:30b-a3b",
    "prompt_eval_count": 137,
    "prompt_eval_duration": 1686780463,
    "total_duration": 3970515188
}

0.9.2:

POST /api/chat HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate, zstd
Connection: keep-alive
Content-Length: 258
Content-Type: application/json
Host: 127.0.0.1:11434
User-Agent: HTTPie/3.2.4

{
    "format": "json",
    "messages": [
        {
            "content": "press the button",
            "role": "user"
        }
    ],
    "model": "qwen3:30b-a3b",
    "stream": false,
    "think": false,
    "tools": [
        {
            "function": {
                "description": "press the button",
                "name": "press_button",
                "parameters": {
                    "type": "object"
                }
            },
            "type": "function"
        }
    ]
}


HTTP/1.1 200 OK
Content-Length: 346
Content-Type: application/json; charset=utf-8
Date: Fri, 20 Jun 2025 17:38:53 GMT

{
    "created_at": "2025-06-20T17:38:53.990564421Z",
    "done": true,
    "done_reason": "stop",
    "eval_count": 13,
    "eval_duration": 599091070,
    "load_duration": 11737053,
    "message": {
        "content": "{\"name\": \"press_button\", \"arguments\": {}}",
        "role": "assistant"
    },
    "model": "qwen3:30b-a3b",
    "prompt_eval_count": 137,
    "prompt_eval_duration": 184490863,
    "total_duration": 795897584
}

OS

Linux

GPU

Nvidia

CPU

AMD

Ollama version

0.9.2

Originally created by @du291 on GitHub (Jun 20, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11147 ### What is the issue? Tool calls appear as json content in messages, since upgrade from 0.9.0 to 0.9.2. ### Relevant log output test command: ```shell http -v -j POST 127.0.0.1:11434/api/chat --raw='{"model":"qwen3:30b-a3b","stream":false,"format":"json","messages":[{"role":"user", "content":"press the button"}],"tools":[{"type":"function","function":{"name":"press_button","description":"press the button","parameters":{"type":"object"}}}],"think":false}' ``` 0.9.0: ``` POST /api/chat HTTP/1.1 Accept: application/json, */*;q=0.5 Accept-Encoding: gzip, deflate, zstd Connection: keep-alive Content-Length: 258 Content-Type: application/json Host: 127.0.0.1:11434 User-Agent: HTTPie/3.2.4 { "format": "json", "messages": [ { "content": "press the button", "role": "user" } ], "model": "qwen3:30b-a3b", "stream": false, "think": false, "tools": [ { "function": { "description": "press the button", "name": "press_button", "parameters": { "type": "object" } }, "type": "function" } ] } HTTP/1.1 200 OK Content-Length: 370 Content-Type: application/json; charset=utf-8 Date: Fri, 20 Jun 2025 17:41:10 GMT { "created_at": "2025-06-20T17:41:10.671386126Z", "done": true, "done_reason": "stop", "eval_count": 13, "eval_duration": 571054871, "load_duration": 1710981976, "message": { "content": "", "role": "assistant", "tool_calls": [ { "function": { "arguments": {}, "name": "press_button" } } ] }, "model": "qwen3:30b-a3b", "prompt_eval_count": 137, "prompt_eval_duration": 1686780463, "total_duration": 3970515188 } ``` 0.9.2: ``` POST /api/chat HTTP/1.1 Accept: application/json, */*;q=0.5 Accept-Encoding: gzip, deflate, zstd Connection: keep-alive Content-Length: 258 Content-Type: application/json Host: 127.0.0.1:11434 User-Agent: HTTPie/3.2.4 { "format": "json", "messages": [ { "content": "press the button", "role": "user" } ], "model": "qwen3:30b-a3b", "stream": false, "think": false, "tools": [ { "function": { "description": "press the button", "name": "press_button", "parameters": { "type": "object" } }, "type": "function" } ] } HTTP/1.1 200 OK Content-Length: 346 Content-Type: application/json; charset=utf-8 Date: Fri, 20 Jun 2025 17:38:53 GMT { "created_at": "2025-06-20T17:38:53.990564421Z", "done": true, "done_reason": "stop", "eval_count": 13, "eval_duration": 599091070, "load_duration": 11737053, "message": { "content": "{\"name\": \"press_button\", \"arguments\": {}}", "role": "assistant" }, "model": "qwen3:30b-a3b", "prompt_eval_count": 137, "prompt_eval_duration": 184490863, "total_duration": 795897584 } ``` ### OS Linux ### GPU Nvidia ### CPU AMD ### Ollama version 0.9.2
GiteaMirror added the bug label 2026-04-12 19:24:14 -05:00
Author
Owner

@jmorganca commented on GitHub (Jun 20, 2025):

Hi @du291 try removing "format": "json", as this causes the model to skip its built-in tool calling:

HTTP/1.1 200 OK
Content-Length: 355
Content-Type: application/json; charset=utf-8
Date: Fri, 20 Jun 2025 18:02:39 GMT

{
    "created_at": "2025-06-20T18:02:39.978001Z",
    "done": true,
    "done_reason": "stop",
    "eval_count": 16,
    "eval_duration": 272924625,
    "load_duration": 20938125,
    "message": {
        "content": "",
        "role": "assistant",
        "tool_calls": [
            {
                "function": {
                    "arguments": {},
                    "name": "press_button"
                }
            }
        ]
    },
    "model": "qwen3",
    "prompt_eval_count": 137,
    "prompt_eval_duration": 167337000,
    "total_duration": 461658334
}

Sorry about that and thanks for the issue!

<!-- gh-comment-id:2992411326 --> @jmorganca commented on GitHub (Jun 20, 2025): Hi @du291 try removing `"format": "json"`, as this causes the model to skip its built-in tool calling: ``` HTTP/1.1 200 OK Content-Length: 355 Content-Type: application/json; charset=utf-8 Date: Fri, 20 Jun 2025 18:02:39 GMT { "created_at": "2025-06-20T18:02:39.978001Z", "done": true, "done_reason": "stop", "eval_count": 16, "eval_duration": 272924625, "load_duration": 20938125, "message": { "content": "", "role": "assistant", "tool_calls": [ { "function": { "arguments": {}, "name": "press_button" } } ] }, "model": "qwen3", "prompt_eval_count": 137, "prompt_eval_duration": 167337000, "total_duration": 461658334 } ``` Sorry about that and thanks for the issue!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#7351