Skip to content

Streaming parser does not handle Ollama's reasoning field for thinking models #805

Closed

Description

@Bodge-IT

Description

When using thinking/reasoning models via Ollama (e.g. Qwen 3.5), Ollama's OpenAI-compatible streaming endpoint places the model's thinking output in a field named reasoning within the delta object. The streaming parser in openai.rs (around line 1152) only checks for reasoning_content, not reasoning. As a result, the thinking output is silently dropped.

Might be similar to issue #785

Ollama streaming chunk example:
{"choices":[{"delta":{"role":"assistant","content":"","reasoning":"Thinking Process:\n..."}}]}

The parser checks:

  • delta["content"] — empty for thinking models
  • delta["reasoning_content"] — not present in Ollama's response

It does not check delta["reasoning"], which is where Ollama places the output.

Expected Behavior

The parser should also check delta["reasoning"] as a fallback, e.g.:
if let Some(reasoning) = delta["reasoning_content"].as_str().or_else(|| delta["reasoning"].as_str()) {

Steps to Reproduce

  1. Pull a thinking model in Ollama: ollama pull qwen3.5
  2. Configure OpenFang with Ollama and qwen3.5:latest
  3. Send a chat message
  4. The thinking output is dropped — no text appears

OpenFang Version

0.5.1

Operating System

Linux (x86_64)

Logs / Screenshots

Version: 0.5.1 (confirmed by reading source at crates/openfang-runtime/src/drivers/openai.rs)

Activity

  1. added a commit that references this issue on Mar 25, 2026
    ea7ddec
  2. added a commit that references this issue on Mar 26, 2026
  3. jaberjaber23 commented on Mar 27, 2026

    @jaberjaber23
    Member

    Fixed in v0.5.3. The streaming parser now checks both delta["reasoning_content"] and delta["reasoning"] so Ollama thinking models like Qwen 3.5 work correctly.

  4. 13 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions