[GH-ISSUE #12551] the absence of reasoning text #34087

Closed
opened 2026-04-22 17:20:09 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @RedAch2000 on GitHub (Oct 9, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12551

What is the issue?

I'm using the qwen3:4b model with Ollama, and I send a POST request from the terminal using the following command:

curl -X POST http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d @request.json

the request.json file contain:

   {
   "model": "qwen3:4b",
   "tools": [
      {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Retrieves the current weather for a given city.",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {
                        "type": "string",
                        "description": "City name."
                    }
                },
                "required": ["city"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "get_time",
            "description": "Returns current local time for a given city",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string", "description": "Name of the city"},
                    "timezone": {"type": "string", "description": "Time zone (optional, e.g., UTC+1)"}
                },
                "required": ["city"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "calculate_sum",
            "description": "Calculates the sum of a list of numbers.",
            "parameters": {
                "type": "object",
                "properties": {
                    "numbers": {
                        "type": "array",
                        "items": { "type": "number" },
                        "description": "List of numbers"
                    }
                },
                "required": ["numbers"]
            }
        }
    }
  
  ],
  "messages": [
    {
      "role": "system",
      "content": "You are expert in tool calling"
    },
    {
        "role": "user",
        "content": "give me the weather in paris",
        "tool_calls": []
    },
    {
        "role": "assistant",
        "content": "\u003cthink\u003e\nOkay, the user asked for the weather in Paris. Let me check which tool I can use. Oh, there's a get_weather function that requires the city name. So I need to call get_weather with city set to \"Paris\". Wait, the parameters say the city is required as a string. The function name is get_weather, and the parameter is \"city\". So the correct tool call would have the city as Paris. Let me make sure I'm using the right parameters. The function needs the city name. So the tool call should be {\"name\": \"get_weather\", \"arguments\": {\"city\": \"Paris\"}}. That's all. Let me output that in the tool_call format.\n\u003c/think\u003e\n\n",
        "tool_calls": [{"id":"call_ayzudna9","index":0,"type":"function","function":{"name":"get_weather","arguments":"{\"city\":\"Paris\"}"}}]
    },
    {
        "role": "tool",
        "content": "{\"tempearture\": \"15 degree Celisius\"}",
        "tool_calls": []
    }
  ],
  "think": true,
  "stream": false
}

I enabled DEBUG mode in Ollama, and when inspecting the prompt actually sent to the model, I found the following log output:

time=2025-10-09T15:04:49.485Z level=TRACE source=server.go:1388 msg="completion request" prompt="<|im_start|>system\n\nYou are Simo, CloudFret’s helpful and professional AI assistant. You greet users warmly, respond clearly and concisely, use tools only when relevant, politely refuse tasks beyond your capabilities, and provide accurate, friendly information about yourself and CloudFret.\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{\"type\": \"function\", \"function\": {\"name\":\"get_weather\",\"description\":\"Retrieves the current weather for a given city.\",\"parameters\":{\"type\":\"object\",\"required\":[\"city\"],\"properties\":{\"city\":{\"type\":\"string\",\"description\":\"City name.\"}}}}}\n{\"type\": \"function\", \"function\": {\"name\":\"get_time\",\"description\":\"Returns current local time for a given city\",\"parameters\":{\"type\":\"object\",\"required\":[\"city\"],\"properties\":{\"city\":{\"type\":\"string\",\"description\":\"Name of the city\"},\"timezone\":{\"type\":\"string\",\"description\":\"Time zone (optional, e.g., UTC+1)\"}}}}}\n{\"type\": \"function\", \"function\": {\"name\":\"calculate_sum\",\"description\":\"Calculates the sum of a list of numbers.\",\"parameters\":{\"type\":\"object\",\"required\":[\"numbers\"],\"properties\":{\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"number\"},\"description\":\"List of numbers\"}}}}}\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n<|im_start|>user\ngive me the weather in paris<|im_end|>\n<|im_start|>assistant\n<tool_call>\n{\"name\": \"get_weather\", \"arguments\": {\"city\":\"Paris\"}}\n</tool_call><|im_end|>\n<|im_start|>user\n{\"tempearture\": \"15 degree Celisius\"}<|im_end|>\n<|im_start|>assistant\n"

Why does the prompt not contain the ... text from the assistant messages?
Is there any way to make Ollama include the thinking content (the inner reasoning text) in the prompt that is sent to the model during inference?

Relevant log output


OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Originally created by @RedAch2000 on GitHub (Oct 9, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12551 ### What is the issue? I'm using the qwen3:4b model with Ollama, and I send a POST request from the terminal using the following command: curl -X POST http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" -d @request.json the request.json file contain: ``` { "model": "qwen3:4b", "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Retrieves the current weather for a given city.", "parameters": { "type": "object", "properties": { "city": { "type": "string", "description": "City name." } }, "required": ["city"] } } }, { "type": "function", "function": { "name": "get_time", "description": "Returns current local time for a given city", "parameters": { "type": "object", "properties": { "city": {"type": "string", "description": "Name of the city"}, "timezone": {"type": "string", "description": "Time zone (optional, e.g., UTC+1)"} }, "required": ["city"] } } }, { "type": "function", "function": { "name": "calculate_sum", "description": "Calculates the sum of a list of numbers.", "parameters": { "type": "object", "properties": { "numbers": { "type": "array", "items": { "type": "number" }, "description": "List of numbers" } }, "required": ["numbers"] } } } ], "messages": [ { "role": "system", "content": "You are expert in tool calling" }, { "role": "user", "content": "give me the weather in paris", "tool_calls": [] }, { "role": "assistant", "content": "\u003cthink\u003e\nOkay, the user asked for the weather in Paris. Let me check which tool I can use. Oh, there's a get_weather function that requires the city name. So I need to call get_weather with city set to \"Paris\". Wait, the parameters say the city is required as a string. The function name is get_weather, and the parameter is \"city\". So the correct tool call would have the city as Paris. Let me make sure I'm using the right parameters. The function needs the city name. So the tool call should be {\"name\": \"get_weather\", \"arguments\": {\"city\": \"Paris\"}}. That's all. Let me output that in the tool_call format.\n\u003c/think\u003e\n\n", "tool_calls": [{"id":"call_ayzudna9","index":0,"type":"function","function":{"name":"get_weather","arguments":"{\"city\":\"Paris\"}"}}] }, { "role": "tool", "content": "{\"tempearture\": \"15 degree Celisius\"}", "tool_calls": [] } ], "think": true, "stream": false } ``` I enabled DEBUG mode in Ollama, and when inspecting the prompt actually sent to the model, I found the following log output: `time=2025-10-09T15:04:49.485Z level=TRACE source=server.go:1388 msg="completion request" prompt="<|im_start|>system\n\nYou are Simo, CloudFret’s helpful and professional AI assistant. You greet users warmly, respond clearly and concisely, use tools only when relevant, politely refuse tasks beyond your capabilities, and provide accurate, friendly information about yourself and CloudFret.\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n{\"type\": \"function\", \"function\": {\"name\":\"get_weather\",\"description\":\"Retrieves the current weather for a given city.\",\"parameters\":{\"type\":\"object\",\"required\":[\"city\"],\"properties\":{\"city\":{\"type\":\"string\",\"description\":\"City name.\"}}}}}\n{\"type\": \"function\", \"function\": {\"name\":\"get_time\",\"description\":\"Returns current local time for a given city\",\"parameters\":{\"type\":\"object\",\"required\":[\"city\"],\"properties\":{\"city\":{\"type\":\"string\",\"description\":\"Name of the city\"},\"timezone\":{\"type\":\"string\",\"description\":\"Time zone (optional, e.g., UTC+1)\"}}}}}\n{\"type\": \"function\", \"function\": {\"name\":\"calculate_sum\",\"description\":\"Calculates the sum of a list of numbers.\",\"parameters\":{\"type\":\"object\",\"required\":[\"numbers\"],\"properties\":{\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"number\"},\"description\":\"List of numbers\"}}}}}\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n<|im_start|>user\ngive me the weather in paris<|im_end|>\n<|im_start|>assistant\n<tool_call>\n{\"name\": \"get_weather\", \"arguments\": {\"city\":\"Paris\"}}\n</tool_call><|im_end|>\n<|im_start|>user\n{\"tempearture\": \"15 degree Celisius\"}<|im_end|>\n<|im_start|>assistant\n"` Why does the prompt not contain the <think>...</think> text from the assistant messages? Is there any way to make Ollama include the thinking content (the inner reasoning text) in the prompt that is sent to the model during inference? ### Relevant log output ```shell ``` ### OS _No response_ ### GPU _No response_ ### CPU _No response_ ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-22 17:20:09 -05:00
Author
Owner

@pdevine commented on GitHub (Oct 9, 2025):

Hey @redaachouhad , You called the Open AI API compatibility endpoint. You'll need to specify "reasoning_effort": "medium" instead of "think": true. The think parameter will only work if you call Ollama's /api/chat endpoint.

I did actually turn this on by default for the next version of Ollama just to decrease the confusion. I'm going to go ahead and close the issue as answer, but lmk if you run into problems.

<!-- gh-comment-id:3387076962 --> @pdevine commented on GitHub (Oct 9, 2025): Hey @redaachouhad , You called the Open AI API compatibility endpoint. You'll need to specify `"reasoning_effort": "medium"` instead of `"think": true`. The `think` parameter will only work if you call Ollama's `/api/chat` endpoint. I did actually turn this on by default for the next version of Ollama just to decrease the confusion. I'm going to go ahead and close the issue as answer, but lmk if you run into problems.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#34087