mirror of
https://github.com/ollama/ollama.git
synced 2026-09-21 13:38:14 -05:00
A format on a thinking model has to leave the thinking free and constrain only the content after it, so whatever enforces the format needs to know where the thinking ends. Today the server guesses whether a parser's response starts inside thinking from the think value alone, which is wrong for parsers whose default differs, and it has no way to learn the closing string at all. Each parser now answers ThinkingClose after Init: the strings any of which ends the thinking its response begins with, or none when the response starts in content because thinking is off, an assistant prefill continues content, or the parser suppresses thinking for tools. Parsers whose models open a new message before content end the thinking at that message's header. Nothing consumes the answer yet.