think flag has no effect when using qwen3:8b #298

Open
opened 2026-02-15 16:29:44 -05:00 by yindo · 5 comments
Owner

Originally created by @kychiu1 on GitHub (Sep 17, 2025).

Passing the think parameter to chat() or AsyncClient.chat() doesn’t appear to change the output or behavior when using the qwen3:8b model.

Environment:

  • ollama-python: 0.5.4
  • ollama version: 0.11.8

My test code:

import asyncio
from ollama import AsyncClient, ChatResponse, chat


async def async_run_chat(think_flag: bool):
    client = AsyncClient(host="http://localhost:11434")  # change host if remote
    prompt = "Give me a concise explanation of why the sky appears blue."

    print(f"\n🔎 Starting chat with think={think_flag}\n")

    async for chunk in await client.chat(
        model="qwen3:8b",  # or any installed model
        messages=[{"role": "user", "content": prompt}],
        stream=True,
        think=think_flag,  # ✅ direct parameter, no options dict
    ):
        text_piece = chunk.get("message", {}).get("content", "")
        if text_piece:
            print(text_piece, end="", flush=True)

    print("\n✅ Done!\n")
    
def stream_run_chat(think_flag: bool):
    stream = chat(
        model='qwen3:8b',
        messages=[{'role': 'user', 'content': 'Why is the sky blue?'}],
        stream=True,
        think=think_flag
    )
    for chunk in stream:
        print(chunk['message']['content'], end='', flush=True)
        
def non_stream_run_chat(think_flag: bool):
    response: ChatResponse = chat(
        model='qwen3:8b', 
        messages=[
            {
                'role': 'user',
                'content': 'Why is the sky blue?',
            },
        ],
        think=think_flag
    )
    print(response['message']['content'])
    
    
if __name__ == "__main__":
    # asyncio.run(async_run_chat(think_flag=False))
    # stream_run_chat(think_flag=False)
    non_stream_run_chat(think_flag=False)
Originally created by @kychiu1 on GitHub (Sep 17, 2025). Passing the think parameter to chat() or AsyncClient.chat() doesn’t appear to change the output or behavior when using the qwen3:8b model. Environment: - ollama-python: 0.5.4 - ollama version: 0.11.8 My test code: ``` import asyncio from ollama import AsyncClient, ChatResponse, chat async def async_run_chat(think_flag: bool): client = AsyncClient(host="http://localhost:11434") # change host if remote prompt = "Give me a concise explanation of why the sky appears blue." print(f"\n🔎 Starting chat with think={think_flag}\n") async for chunk in await client.chat( model="qwen3:8b", # or any installed model messages=[{"role": "user", "content": prompt}], stream=True, think=think_flag, # ✅ direct parameter, no options dict ): text_piece = chunk.get("message", {}).get("content", "") if text_piece: print(text_piece, end="", flush=True) print("\n✅ Done!\n") def stream_run_chat(think_flag: bool): stream = chat( model='qwen3:8b', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}], stream=True, think=think_flag ) for chunk in stream: print(chunk['message']['content'], end='', flush=True) def non_stream_run_chat(think_flag: bool): response: ChatResponse = chat( model='qwen3:8b', messages=[ { 'role': 'user', 'content': 'Why is the sky blue?', }, ], think=think_flag ) print(response['message']['content']) if __name__ == "__main__": # asyncio.run(async_run_chat(think_flag=False)) # stream_run_chat(think_flag=False) non_stream_run_chat(think_flag=False) ```
Author
Owner

@steliosm commented on GitHub (Sep 19, 2025):

Saw the same issue also when using the qwen3:8b.
Currently using:
ollama-python: 0.5.4
ollama version: 0.11.10

@steliosm commented on GitHub (Sep 19, 2025): Saw the same issue also when using the qwen3:8b. Currently using: ollama-python: 0.5.4 ollama version: 0.11.10
Author
Owner

@zhenyu-24 commented on GitHub (Oct 16, 2025):

It may be that the ollama version does not correspond to the ollama-python version. The newer version has been updated and use the thinking in the message

@zhenyu-24 commented on GitHub (Oct 16, 2025): It may be that the ollama version does not correspond to the ollama-python version. The newer version has been updated and use the thinking in the message
Author
Owner

@ParthSareen commented on GitHub (Nov 11, 2025):

Can you pull the qwen models

@ParthSareen commented on GitHub (Nov 11, 2025): Can you `pull` the qwen models
Author
Owner

@JamesCHub commented on GitHub (Dec 16, 2025):

With ollama-python v0.6.1 and qwen3:4b, the think argument doesn't prevent thinking, rather it results in all the thinking being combined with the output. Including directives in the prompt seem to be effective. e.g. "Do not provide reasoning or background."

@JamesCHub commented on GitHub (Dec 16, 2025): With ollama-python v0.6.1 and qwen3:4b, the think argument doesn't prevent thinking, rather it results in all the thinking being combined with the output. Including directives in the prompt seem to be effective. e.g. "Do not provide reasoning or background."
Author
Owner

@ParthSareen commented on GitHub (Dec 16, 2025):

@JamesCHub can you provide me the request you're making ?

@ParthSareen commented on GitHub (Dec 16, 2025): @JamesCHub can you provide me the request you're making ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#298