[Bugfix][Structured Output] Feed the token that implicitly ends reasoning to the grammar (#59627)

Signed-off-by: Simon Veitner <sveitner@redhat.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Misha Goin <mgoin64@gmail.com>
Co-authored-by: Yifan Zong <263738792+yzong-rh@users.noreply.github.com>
This commit is contained in:
simon-veitner-redhat
2026-10-08 19:38:33 +00:00
committed by GitHub
co-authored by Claude Opus 5.5 Misha Goin Yifan Zong
parent bab0ac61f8
commit c23ca06b6d
7 changed files with 150 additions and 52 deletions
+2 -2
View File
@@ -643,8 +643,8 @@ class TestImplicitReasoningEnd:
# token-ID fast path; the implicit tool-call exit still goes through
# the text lexer.
assert thinking_parser.reasoning_end_token_ids == {_THINK_END_ID}
assert thinking_parser.find_reasoning_end_offset([7, _THINK_END_ID, 8]) == 1
assert thinking_parser.find_reasoning_end_offset([7, 8]) == 2
assert thinking_parser.find_reasoning_end([7, _THINK_END_ID, 8]) == (1, False)
assert thinking_parser.find_reasoning_end([7, 8]) == (2, False)
def test_streaming_reasoning_implicit_end(self, thinking_parser):
chunks = [