Skip to content

docs: document ModelOption.THINKING behaviour for Granite - #1645

Merged
jakelorocco merged 5 commits into
mainfrom
issue-1638
Sep 16, 2026
Merged

jakelorocco merged 5 commits into
mainfrom
issue-1638

Conversation

@planetf1

Copy link
Copy Markdown
Contributor

ModelOption.THINKING already works for controlling Granite 4.2 reasoning on the native Ollama, OpenAI, and LiteLLM backends — including the "low"/"medium"/"high" string levels — but nothing in the docs said so. The one substantive treatment that existed (openai.md's thinking section) was framed entirely around Qwen3 on vLLM using raw extra_body/enable_thinking, which pointed readers at the lower-level workaround instead of the higher-level ModelOption.THINKING API that's actually the preferred entry point when a backend honours it.

This expands the vague one-line ModelOption.THINKING table row in configure-model-options.md into a proper subsection with a per-backend behaviour table (native Ollama / OpenAI-compatible / HF), documents Granite 4.2's "low"-only effort distinction ("medium"/"high" are accepted but behave like True) and its default-on-when-unset behaviour, and adds a working example (docs/examples/thinking_mode.py) exercising True/False/"low" against a local granite4.2:3b Ollama model. It also cross-links openai.md's Qwen3/vLLM section to point at ModelOption.THINKING as the preferred portable mechanism, keeping the existing extra_body content as the documented fallback for backends/params it doesn't cover.

The LocalHFBackend row is documented as "not supported" (string values are silently dropped today) with a link to #1636, since the fix (#1639) hasn't merged yet. That row should be updated once #1639 lands.

What's out of scope

Verification

  • uv run python docs/examples/thinking_mode.py — ran live against granite4.2:3b on local Ollama. Confirmed THINKING=True produces a long reasoning trace, THINKING="low" a short one, THINKING=False none, matching what's documented.
  • npx markdownlint-cli "docs/docs/**/*.md" --config docs/docs/.markdownlint.json — clean on both edited files (one pre-existing, unrelated MD060 finding on a table this PR didn't touch).
  • uv run ruff format/ruff check/mypy on the new example — clean.
  • pre-commit run on the changed files — all hooks pass.

Fixes #1638

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 10, 2026
@planetf1

Copy link
Copy Markdown
Contributor Author

Updated to document the `LocalHFBackend` row assuming #1639 (HF string-level forwarding) and #1616 (HF `` tag parsing) merge — both now describe HF as matching Ollama/OpenAI behaviour rather than "not supported".

Merge-order note: this PR should merge after #1639 and #1616, otherwise the `LocalHFBackend` row describes behaviour that isn't live on `main` yet.

@planetf1

planetf1 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor Author

No description provided.

…mple

Adds a per-backend reasoning/thinking-mode reference table (native Ollama,
OpenAI/LiteLLM, HF) to configure-model-options.md, including Granite 4.2's
"low"-only effort distinction and its default-on behaviour, and cross-links
it from openai.md's existing Qwen3/vLLM extra_body section as the preferred
portable entry point. Adds docs/examples/thinking_mode.py demonstrating
THINKING=True/False/"low" against a local Ollama Granite model, verified
live against granite4.2:3b.

Fixes #1638

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
Documents ModelOption.THINKING string levels and result.thinking as
supported on LocalHFBackend too, matching the state after #1639 (HF string
forwarding fix) and #1616 (HF <think> tag parsing) merge. Both are still
open — this docs PR should merge after them, or the LocalHFBackend row will
describe behaviour that isn't live yet.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
- Qualify the OpenAIBackend/LiteLLM `False` cell: real OpenAI reasoning
  models and non-Ollama LiteLLM targets never receive `reasoning_effort=
  "none"` (openai.py's server-type guard, litellm.py's ollama-prefix guard),
  so `False` does not actually disable thinking there.
- Add an inline callout marking the LocalHFBackend string-forwarding and
  result.thinking claims as contingent on #1639/#1616 merging, instead of
  only noting it in the PR description/comment.
- Correct "same mechanism as the OpenAI backend" — HF forwards through a
  gated chat-template variable, OpenAI sends an ungated top-level param.
- Note the runtime-forwarding dependency for the cross-backend Granite
  claim, add a `> Full example:` link, fix the unresolvable bare "#1617"
  reference, add a non-determinism note to the new code block, drop the
  unnecessary `qualitative` marker, and fix US-English spelling in new
  content per CONTRIBUTING_DOCS.md.
- Add cheap assertions to docs/examples/thinking_mode.py pinning the
  documented per-arm behaviour; reran live against granite4.2:3b, all pass.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
#1639 (HF string-forwarding) merged 2026-09-10; only #1616
(result.thinking parsing) remains open. Also note that #1616's
<think>-tag split is skipped for streaming (m serve) calls, per
its own PR description.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <[email protected]>
@planetf1
planetf1 marked this pull request as ready for review September 15, 2026 16:37
@planetf1
planetf1 requested a review from a team as a code owner September 15, 2026 16:37

@AngeloDanducci AngeloDanducci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jakelorocco jakelorocco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; we should remove the specific reference to the not yet merged PR and then merge afterwards

Comment thread docs/examples/thinking_mode.py Resolved
@planetf1

Copy link
Copy Markdown
Contributor Author

@jakelorocco if you’re ok with above this is a candidate for our release

@jakelorocco jakelorocco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think this is worth including; one proposed change to the doc since the other PRs are in; thank you!

#1616 and #1639 have both merged, so LocalHFBackend's result.thinking
split is now current-main behaviour, not a future dependency.

Assisted-by: Claude Code
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Nigel Jones <[email protected]>
@planetf1

Copy link
Copy Markdown
Contributor Author

@jakelorocco should be good to approve/merge (feel free to merge when you are ready if needed for release)

@jakelorocco
jakelorocco added this pull request to the merge queue Sep 16, 2026
Merged via the queue into main with commit cee2f7e Sep 16, 2026
11 checks passed
@jakelorocco
jakelorocco deleted the issue-1638 branch September 16, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: THINKING/reasoning-effort control is undocumented for Granite, and openai.md's example steers readers to the wrong mechanism

3 participants