Skip to content

Add Ollama native thinking/reasoning support #831

Description

@navedmerchant

Is your feature request related to a problem? Please describe.

Ollama supports a native think request parameter (boolean | "high" | "medium" | "low") for reasoning models such as qwen3 and deepseek-r1, and streams reasoning via a separate message.thinking field. Zoo Code's native Ollama handler currently does not surface this capability:

  • There is no UI toggle to enable Ollama's native thinking, so users of reasoning models cannot take advantage of the dedicated reasoning channel.
  • Reasoning emitted in message.thinking is dropped on the floor instead of being streamed as a reasoning chunk, so it is never rendered or preserved across turns.
  • Prior assistant reasoning/thinking content blocks in the conversation history are not round-tripped back to Ollama, so multi-turn thinking context is lost.

Describe the solution you'd like

  • Add an "Enable Thinking" checkbox to the Ollama provider settings that controls enableReasoningEffort and exposes a ThinkingBudget selector (low/medium/high) mapped to Ollama's think parameter.
  • In NativeOllamaHandler, map the configured reasoning effort to Ollama's native think parameter and send it on both the streaming and single-shot completion paths. When unconfigured, send no think parameter so the model/Modelfile stays in control (preserving prior behavior).
  • Stream chunk.message.thinking as reasoning chunks so the reasoning is rendered and preserved like other providers.
  • Round-trip prior reasoning/thinking content blocks from assistant history into Ollama's thinking field so multi-turn thinking is preserved.

Describe alternatives you've considered

  • Relying solely on TagMatcher to detect <think>/<thought> tags in content. This works for models that inline reasoning in content, but does not use Ollama's dedicated think parameter or message.thinking field, so the reasoning budget cannot be controlled and the dedicated reasoning channel is unused.

Additional context

  • Ollama thinking docs: https://docs.ollama.com/capabilities/thinking
  • The installed ollama SDK (v0.6.x) only types think as boolean | "high" | "medium" | "low"; "max" is clamped to "high" until the SDK types catch up.
  • Reasoning is off by default; it only activates when the user explicitly enables the checkbox.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions