model/parsers: honor think value when initializing the qwen3-vl parser - #16953
Closed
tenderdeve wants to merge 1 commit into
Closed
tenderdeve wants to merge 1 commit into
tenderdeve wants to merge 1 commit into
Conversation
The qwen3-vl parser always started in the thinking-collection state when the model supported thinking, ignoring the request's think value. With think=false the model emits an answer directly with no </think> tag, so the parser kept treating every token as reasoning and never produced content, ending in finish_reason=length. Pass the think value through to setInitialState and start in the content state when thinking is disabled, matching the qwen3.5 and deepseek3 parsers. Fixes ollama#16945
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16945
The qwen3-vl parser always started in the thinking-collection state whenever the model supported thinking, ignoring the request's
thinkvalue. Withthink: falsethe model emits an answer directly without a</think>tag, so the parser kept treating every token as reasoning, never emitted content, and the stream ended withfinish_reason: length.setInitialStatenow receives thethinkvalue and starts in the content state when thinking is disabled, matching how the qwen3.5 and deepseek3 parsers already behave. Thinking stays on by default when no value is passed, so existing behavior is unchanged.Added cases to
TestQwen3VLParserStatecoveringthink=false,think=true, andthink="high".