Read the assistant `reasoning` field (vLLM / Responses API name) when rendering history

#88
by gdevenyi - opened

Summary

The history renderer reads message.reasoning_content, then message.thinking, then in-content <think> tags. It does not read message.reasoning, which is the field name vLLM now returns first (reasoning_content is marked deprecated in vLLM's ChatMessage) and the name the OpenAI Responses API uses.

vLLM itself is not affected (it renames an incoming reasoning_content to reasoning and then sets both keys before rendering). But a client that echoes vLLM's message.reasoning back to llama.cpp, LM Studio or oMLX loses the thought: the template renders an empty <think>\n\n</think> block in place of it.

Changes

  • chat_template.jinja: add message.reasoning to the extraction chain (after reasoning_content, before thinking), same string/non-string handling as the other two fields.
  • chat_template_oneline.txt: regenerated with scripts/minify_jinja.py.
  • scripts/test_v22.py: new test 24b covering the reasoning field.
  • README.md: one phrase in the feature table.

Verification

python3 scripts/test_v22.py → 101/101, python3 scripts/test_v21.py → 9/9, python3 scripts/fuzz_template.py --cases 200 → clean.

Merged, thanks! Handy to have reasoning handled directly for vLLM and Responses API payloads.

froggeric changed pull request status to closed

Sign up or log in to comment