[Bugfix][Gemma4] Pre-initialise streaming reasoning state when prompt ends inside an open <|channel> (fixes #45834) (#45852)
Signed-off-by: nikhilesh-csa <nchhetri@csa1.com>
This commit is contained in:
@@ -758,6 +758,13 @@ class DelegatingParser(Parser):
|
||||
prompt_token_ids
|
||||
):
|
||||
state.reasoning_ended = True
|
||||
else:
|
||||
# Reasoning is still open at the end of the prompt; let the
|
||||
# reasoning parser adjust its initial parsing state so the
|
||||
# first generated tokens are classified correctly.
|
||||
self._reasoning_parser.adjust_initial_state_from_prompt(
|
||||
prompt_token_ids
|
||||
)
|
||||
|
||||
current_text, current_token_ids = state.advance(delta_text, delta_token_ids)
|
||||
delta_message: DeltaMessage | None = None
|
||||
|
||||
Reference in New Issue
Block a user