[GH-ISSUE #11185] Ollama 0.9.2 never function_calls or tool_calls and fill content instead #69431

Closed
opened 2026-05-04 18:04:17 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @JpEncausse on GitHub (Jun 24, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11185

What is the issue?

Ollama 0.9.2 NEVER call correctly Tools since 0.9.2 and there is no workaround. Please roll back Ollama !

  • ChatGPT advice to force post.function_call but it doesn't work better and LLM MUST choose tools
  • ChatGPT advice to declare a NOP fake tools ... WTF ?

Models like qwen3:32b REPLY tool calls in the content of the message and `qwen3:8b often hallucinate :

{
    "model": "qwen3:32b",
    "created_at": "2025-06-24T20:55:49.5546988Z",
    "message": {
        "role": "assistant",
        "content": "{\"name\": \"LLM_Tool_RAG\", \"arguments\": {\"term\": \"accidents, tribunal de Versailles\", \"vector\": \"accidents tribunal Versailles jugements\"}}"
    },
    "done_reason": "stop",
    "done": true,
    "total_duration": 16534413000,
    "load_duration": 21226300,
    "prompt_eval_count": 583,
    "prompt_eval_duration": 4321418400,
    "eval_count": 39,
    "eval_duration": 12187572000
}

Ollama MUST follow it's specifications and provides "tool_calls": [] and "done_reason": "tool",

{
  "model": "qwen3:32b",
  "created_at": "2025-06-24T20:55:49.5546988Z",
  "message": {
    "role": "assistant",
    "tool_calls": [
      {
        "name": "LLM_Tool_RAG",
        "arguments": {
          "term": "accidents, tribunal de Versailles",
          "vector": "accidents tribunal Versailles jugements"
        }
      }
    ]
  },
  "done_reason": "tool",
  "done": true,
  "total_duration": 16534413000,
  "load_duration": 21226300,
  "prompt_eval_count": 583,
  "prompt_eval_duration": 4321418400,
  "eval_count": 39,
  "eval_duration": 12187572000
}

The HTTP POST Request:


{
    "model": "qwen3:32b",
    "stream": false,
    "format": "json",
    "num_ctx": 8192,
    "temperature": 0.1,
    "num_predict": 4000,
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "LLM_Tool_NOP",
                "description": "Dummy Tool that do nothing",
                "parameters": {
                    "type": "object",
                    "properties": {},
                    "required": []
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "LLM_Tool_RAG",
                "description": "Query a DATABASE about judgements issued by various French tribunals. ALL parameters are required.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "term": {
                            "type": "string",
                            "description": "List of short and focused terms, comma separated."
                        },
                        "vector": {
                            "type": "string",
                            "description": "Search sentence build from the user query."
                        }
                    },
                    "required": [
                        "term",
                        "vector"
                    ]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "LLM_Tool_HOME_Light",
                "description": "Switch On/Off Light. Change Colors",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "room": {
                            "type": "array",
                            "description": "Array of room to work with. \n        LIMITED VALUES: salon, bureau, chambre1, chambre2, entree, sallebain, couloir, escalier, cuisine, cave"
                        },
                        "dim": {
                            "type": "number",
                            "description": "Light luminosity between 0 (off) to 100 (on)"
                        },
                        "color": {
                            "type": "string",
                            "description": "A light color in hexa example: FFAACC"
                        }
                    },
                    "required": [
                        "room",
                        "dim"
                    ]
                }
            }
        },
        {
            "type": "function",
            "function": {
                "name": "LLM_Tool_INTERNAL_Image",
                "description": "You are Multimodal and can understand Image URL",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "image": {
                            "type": "string",
                            "description": "The image url"
                        }
                    },
                    "required": [
                        "image"
                    ]
                }
            }
        }
    ],
    "messages": [
        {
            "role": "system",
            "content": "Current date is: 24/06/2025 22:55:33\n\n# ROLE \n1. Analyze the user\u2019s message.\n2. Determine and Call function(s) tool(s) that are necessary to answer.\n3. After function or tool execution, respond with the final JSON:\n{\n  \"text\": \"<Markdown-formatted answer>\",\n  \"speech\": \"<Plain-text for TTS>\",\n}\n\n# FORMAT RULES\n- No additional text outside the JSON/blocs.\n- Follow the sequence strictly: analyze => tool_call => response.\n\nFunction or Tool MUST ALWAYS be declared in message.function_calls[] NEVER in message.content"
        },
        {
            "role": "user",
            "content": "Cherche les jugements d'accidents au tribunal de versailles. Ne demande pas de pr\u00e9cisions. Cherche dans le RAG."
        }
    ]
}

Relevant log output


OS

Windows

GPU

Nvidia

CPU

AMD

Ollama version

0.9.2

Originally created by @JpEncausse on GitHub (Jun 24, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11185 ### What is the issue? Ollama 0.9.2 NEVER call correctly Tools since 0.9.2 and there is no workaround. Please roll back Ollama ! - ChatGPT advice to force `post.function_call` but it doesn't work better and LLM MUST choose tools - ChatGPT advice to declare a NOP fake tools ... WTF ? Models like `qwen3:32b` REPLY tool calls in the content of the message and `qwen3:8b often hallucinate : ``` { "model": "qwen3:32b", "created_at": "2025-06-24T20:55:49.5546988Z", "message": { "role": "assistant", "content": "{\"name\": \"LLM_Tool_RAG\", \"arguments\": {\"term\": \"accidents, tribunal de Versailles\", \"vector\": \"accidents tribunal Versailles jugements\"}}" }, "done_reason": "stop", "done": true, "total_duration": 16534413000, "load_duration": 21226300, "prompt_eval_count": 583, "prompt_eval_duration": 4321418400, "eval_count": 39, "eval_duration": 12187572000 } ``` Ollama MUST follow it's specifications and provides **"tool_calls": []** and **"done_reason": "tool",** ``` { "model": "qwen3:32b", "created_at": "2025-06-24T20:55:49.5546988Z", "message": { "role": "assistant", "tool_calls": [ { "name": "LLM_Tool_RAG", "arguments": { "term": "accidents, tribunal de Versailles", "vector": "accidents tribunal Versailles jugements" } } ] }, "done_reason": "tool", "done": true, "total_duration": 16534413000, "load_duration": 21226300, "prompt_eval_count": 583, "prompt_eval_duration": 4321418400, "eval_count": 39, "eval_duration": 12187572000 } ``` The HTTP POST Request: ``` { "model": "qwen3:32b", "stream": false, "format": "json", "num_ctx": 8192, "temperature": 0.1, "num_predict": 4000, "tools": [ { "type": "function", "function": { "name": "LLM_Tool_NOP", "description": "Dummy Tool that do nothing", "parameters": { "type": "object", "properties": {}, "required": [] } } }, { "type": "function", "function": { "name": "LLM_Tool_RAG", "description": "Query a DATABASE about judgements issued by various French tribunals. ALL parameters are required.", "parameters": { "type": "object", "properties": { "term": { "type": "string", "description": "List of short and focused terms, comma separated." }, "vector": { "type": "string", "description": "Search sentence build from the user query." } }, "required": [ "term", "vector" ] } } }, { "type": "function", "function": { "name": "LLM_Tool_HOME_Light", "description": "Switch On/Off Light. Change Colors", "parameters": { "type": "object", "properties": { "room": { "type": "array", "description": "Array of room to work with. \n LIMITED VALUES: salon, bureau, chambre1, chambre2, entree, sallebain, couloir, escalier, cuisine, cave" }, "dim": { "type": "number", "description": "Light luminosity between 0 (off) to 100 (on)" }, "color": { "type": "string", "description": "A light color in hexa example: FFAACC" } }, "required": [ "room", "dim" ] } } }, { "type": "function", "function": { "name": "LLM_Tool_INTERNAL_Image", "description": "You are Multimodal and can understand Image URL", "parameters": { "type": "object", "properties": { "image": { "type": "string", "description": "The image url" } }, "required": [ "image" ] } } } ], "messages": [ { "role": "system", "content": "Current date is: 24/06/2025 22:55:33\n\n# ROLE \n1. Analyze the user\u2019s message.\n2. Determine and Call function(s) tool(s) that are necessary to answer.\n3. After function or tool execution, respond with the final JSON:\n{\n \"text\": \"<Markdown-formatted answer>\",\n \"speech\": \"<Plain-text for TTS>\",\n}\n\n# FORMAT RULES\n- No additional text outside the JSON/blocs.\n- Follow the sequence strictly: analyze => tool_call => response.\n\nFunction or Tool MUST ALWAYS be declared in message.function_calls[] NEVER in message.content" }, { "role": "user", "content": "Cherche les jugements d'accidents au tribunal de versailles. Ne demande pas de pr\u00e9cisions. Cherche dans le RAG." } ] } ``` ### Relevant log output ```shell ``` ### OS Windows ### GPU Nvidia ### CPU AMD ### Ollama version 0.9.2
GiteaMirror added the bug label 2026-05-04 18:04:17 -05:00
Author
Owner

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

Hi @JpEncausse sorry about the issue. "format": "json" will not work with tools as models require other control tokens to be output in order for successful tool calling. If you remove "format": "json" tool calling will work:

{"model":"qwen3:30b-a3b","created_at":"2025-06-24T21:18:31.216469Z","message":{"role":"assistant","content":"\u003cthink\u003e\nOkay, the user is asking to search for judgments related to accidents at the Versailles court using the RAG tool. Let me check the available functions. The LLM_Tool_RAG requires both 'term' and 'vector' parameters. The user mentioned \"jugements d'accidents\" and \"tribunal de Versailles\". So, I'll set 'term' to \"accidents, jugements\" and 'vector' to \"accidents at Versailles court\". I need to make sure both parameters are included. No other tools seem necessary here. Let me structure the tool call accordingly.\n\u003c/think\u003e\n\n","tool_calls":[{"function":{"name":"LLM_Tool_RAG","arguments":{"term":"accidents, jugements","vector":"accidents at Versailles court"}}}]},"done_reason":"stop","done":true,"total_duration":3292787792,"load_duration":23554542,"prompt_eval_count":583,"prompt_eval_duration":481477083,"eval_count":162,"eval_duration":2785346542}

In the future we will update the API to not allow format json with tool calling

<!-- gh-comment-id:3001890624 --> @jmorganca commented on GitHub (Jun 24, 2025): Hi @JpEncausse sorry about the issue. `"format": "json"` will not work with tools as models require other control tokens to be output in order for successful tool calling. If you remove `"format": "json"` tool calling will work: ``` {"model":"qwen3:30b-a3b","created_at":"2025-06-24T21:18:31.216469Z","message":{"role":"assistant","content":"\u003cthink\u003e\nOkay, the user is asking to search for judgments related to accidents at the Versailles court using the RAG tool. Let me check the available functions. The LLM_Tool_RAG requires both 'term' and 'vector' parameters. The user mentioned \"jugements d'accidents\" and \"tribunal de Versailles\". So, I'll set 'term' to \"accidents, jugements\" and 'vector' to \"accidents at Versailles court\". I need to make sure both parameters are included. No other tools seem necessary here. Let me structure the tool call accordingly.\n\u003c/think\u003e\n\n","tool_calls":[{"function":{"name":"LLM_Tool_RAG","arguments":{"term":"accidents, jugements","vector":"accidents at Versailles court"}}}]},"done_reason":"stop","done":true,"total_duration":3292787792,"load_duration":23554542,"prompt_eval_count":583,"prompt_eval_duration":481477083,"eval_count":162,"eval_duration":2785346542} ``` In the future we will update the API to not allow format json with tool calling
Author
Owner

@JpEncausse commented on GitHub (Jun 25, 2025):

OMG thanks for the answer !
You should really really details each parameters of the API.
Behaviors really change according to the usecase, model and/or the way to set them (HTTP, CLI, ...)

In my case, I ask for a structured JSON Answer that may requires calling tools before.

<!-- gh-comment-id:3003686085 --> @JpEncausse commented on GitHub (Jun 25, 2025): OMG thanks for the answer ! You should really really details each parameters of the API. Behaviors really change according to the usecase, model and/or the way to set them (HTTP, CLI, ...) In my case, I ask for a structured JSON Answer that may requires calling tools before.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69431