Repository navigation
Open
Labels
area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMarea/componentComponent type system, CBlock, @generative decorator, prompt templates, RichDocumentarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationarea/thinkingReasoning/thinking control: enable_thinking, reasoning_effort, low_effort, THINKING mappingenhancementNew feature or requestneeds-designProblem is clear; implementation approach needs design discussion before work startsp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.
Description
Problem
Mellea has no way to know at session setup (or call time) that a model supports thinking / extended reasoning. This matters because:
- vLLM + Granite: thinking tier is controlled via
chat_template_kwargsinextra_body— a vLLM-specific field. There is no standard way to forward a thinking tier (NOTHINK / LIGHT / DEEP) without knowing the model supports it and what the field name is. - HF / transformers: thinking is controlled by a Jinja template variable (
thinkorthinkingdepending on the model family). The variable name is not standardised across models. We currently silently dropModelOption.THINKING— see enhancement: huggingface should handle ModelOption.THINKING #1212. - Ollama / LiteLLM: similar provider-specific variations.
The practical consequence: callers who want thinking enabled must hard-code provider-specific parameters rather than using a portable Mellea abstraction. There is no error when thinking is requested but silently ignored.
Proposed direction
Rather than a single global model registry, the approach should be per-backend capability detection:
- Each backend exposes whether the loaded model supports thinking (detected from the chat template, model card, or an explicit override).
ModelOption.THINKING(already defined) is mapped to the correct provider-specific parameter by the backend — e.g.chat_template_kwargs: {enable_thinking: true}for vLLM,think: truefor HF Granite.- A common
ModelCapability.THINKINGflag (or similar) can be surfaced on the backend so callers can branch on it if needed.
The default_extra_body addition on OpenAIBackend (#1453) is the immediate unblocking step for vLLM. This issue covers the higher-level abstraction that makes thinking portable across backends.
Out of scope
- Training or fine-tuning thinking models.
- Controlling thinking budget as a first-class concept (that's a follow-on once the basic flag works).
Acceptance criteria
ModelOption.THINKINGforwarded correctly to Granite on both the HF and OpenAI-compatible backends without any provider-specific caller code.- Silent drop of
ModelOption.THINKINGis replaced by either correct forwarding or an explicitUnsupportedModelOptionwarning. - At least one e2e test demonstrating thinking enabled vs disabled on Granite 4.1 via Ollama or vLLM.
Related
- feat(backends): add default_extra_body to OpenAIBackend for vLLM/vendor-specific per-request fields #1453 —
default_extra_bodyonOpenAIBackend(immediate unblocking step, vLLM path) - enhancement: huggingface should handle ModelOption.THINKING #1212 — HF backend: auto-map
ModelOption.THINKINGfrom chat template vars - Generative stub prompt template underperforms on smaller models #1476 —
@generativeprompt template underperforms on smaller models (thinking budget interaction)
Metadata
Metadata
Assignees
Labels
area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMarea/componentComponent type system, CBlock, @generative decorator, prompt templates, RichDocumentarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationarea/thinkingReasoning/thinking control: enable_thinking, reasoning_effort, low_effort, THINKING mappingenhancementNew feature or requestneeds-designProblem is clear; implementation approach needs design discussion before work startsp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.
Activity
psschwei commentedon May 12, 2026
still open question on whether this is something we should do, not high priority
planetf1 commentedon Aug 5, 2026
Adding a concrete use-case for vLLM + Granite, since this issue sits at the intersection of "thinking models" and Mellea integration.
The specific problem: vLLM's Granite thinking tier is controlled via
chat_template_kwargsinextra_body— a vLLM-specific field not in the OpenAI spec. To forward a thinking tier (NOTHINK/LIGHT/DEEP) into Mellea's draft calls, you'd need:This does not work today because
extra_bodyinmodel_optionshits the collision bug fixed in PR #1204 (intrinsic path still needs the fix per #1241). And even after that fix, there's no clean construction-time equivalent.What we'd want: Either a
default_extra_bodyonOpenAIBackend(see #1453), or a per-callmodel_optionsoverride oninstruct()(see #1452), so thinking tier can be specified once without tearing down the session.Beyond the API surface, a higher-level
thinking_tierconcept onOpenAIBackendcould abstract away the vLLM-specificchat_template_kwargs— which is what this issue originally proposed. We'd be interested in that direction too.planetf1 commentedon Sep 9, 2026
One more thing worth scoping into this design: Granite 4.2 defaults to thinking ON if
ModelOption.THINKINGis omitted entirely (enable_thinking if defined else Truein the chat template — seemellea/backends/model_options.py:74). There's no safe no-op default here; every call against a Granite 4.2 model pays full reasoning cost (tokens + latency) unless the caller explicitly setsTHINKING=False.Any unified
ModelCapability.THINKINGabstraction should make this default explicit and documented per-model (not just NOTHINK/LOW/DEFAULT as states, but which one a given model lands on when unset) — otherwise the abstraction just relocates the current surprise-cost problem rather than fixing it.Also linked two standalone bugs found while investigating this (#1636, #1637) — both prerequisites/related, not folded into this design issue.