[Perf] Eliminate full-history reasoning scans for structured outputs (#55223)
Signed-off-by: sfeng33 <4florafeng@gmail.com> Signed-off-by: Flora Feng <4florafeng@gmail.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
This commit is contained in:
@@ -416,6 +416,17 @@ class TestImplicitReasoningEnd:
|
||||
args = json.loads(tool_calls[0].arguments)
|
||||
assert args == {"location": "NYC"}
|
||||
|
||||
def test_reasoning_end_token_ids_drop_multi_token_tool_opener(
|
||||
self, thinking_parser
|
||||
):
|
||||
# Like the real DeepSeek-V4 tokenizer, the mock vocab has no single
|
||||
# token for the DSML tool opener, so only </think> is tracked on the
|
||||
# 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]) is None
|
||||
|
||||
def test_streaming_reasoning_implicit_end(self, thinking_parser):
|
||||
chunks = [
|
||||
"Let me look up the weather.\n\n",
|
||||
|
||||
Reference in New Issue
Block a user