You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: implement better hugging face output parsing #1604
area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMp1High: important bugs (workaround exists) or high-value core features. Do soon, not on fire.
We should implement output parsing for the hugging face backend. We currently scan the output for tools, but we don't do this for thinking tokens (and any others that we might want to capture).
The transformers library also added it's own output parser capabilities with models being able to define their own response schemas; we could utilize this for models that have it defined, and fall back to some simple parsing for our own.
Status (2026-10-06): the Granite-specific parsing is done; the general work is still open.
Done: for non-streaming generation, thinking tags now parse into mot.thinking on LocalHFBackend via _split_think_tags() (PR #1616, merged 2026-09-16), applied where the chat template declares a thinking variable. Granite XML tool calls also parse on the local HF path (PR #1692, merged 2026-10-05).
Still open, in three parts:
The parser only knows Granite's convention. _split_think_tags() is a fixed string match on the closing think tag, and output from models that use other reasoning delimiters passes through unparsed.
The transformers-native path is unused. PreTrainedTokenizerBase.parse_response() parses output against a schema the tokenizer declares, but no tokenizer available to this backend declares a response_schema today, so the backend never calls it. The API is available in the transformers this repo resolves to (5.10.2, within the >5.5.0,<6.0.0 pin).
The split only runs on non-streaming generation.
The docstring of _split_think_tags() records parts 1 and 2 with "see #1604" pointers, so this issue remains the right home for that work.
area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMp1High: important bugs (workaround exists) or high-value core features. Do soon, not on fire.
Activity
jakelorocco commentedon Sep 29, 2026
https://huggingface.co/docs/transformers/en/chat_response_parsing
planetf1 commentedon Oct 6, 2026
Status (2026-10-06): the Granite-specific parsing is done; the general work is still open.
Done: for non-streaming generation, thinking tags now parse into
mot.thinkingon LocalHFBackend via_split_think_tags()(PR #1616, merged 2026-09-16), applied where the chat template declares a thinking variable. Granite XML tool calls also parse on the local HF path (PR #1692, merged 2026-10-05).Still open, in three parts:
_split_think_tags()is a fixed string match on the closingthinktag, and output from models that use other reasoning delimiters passes through unparsed.PreTrainedTokenizerBase.parse_response()parses output against a schema the tokenizer declares, but no tokenizer available to this backend declares aresponse_schematoday, so the backend never calls it. The API is available in the transformers this repo resolves to (5.10.2, within the >5.5.0,<6.0.0 pin).The docstring of
_split_think_tags()records parts 1 and 2 with "see #1604" pointers, so this issue remains the right home for that work.