[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:
@@ -219,6 +219,21 @@ class Parser:
|
||||
"""
|
||||
return self.is_reasoning_end(input_ids)
|
||||
|
||||
def find_reasoning_end_offset(self, token_ids: Sequence[int]) -> int | None:
|
||||
"""
|
||||
Locate the token that ends reasoning within one window of tokens.
|
||||
|
||||
Args:
|
||||
token_ids: The tokens to examine.
|
||||
|
||||
Returns:
|
||||
The offset within ``token_ids`` of the last reasoning token, or
|
||||
``None`` when reasoning does not end in this window. Parsers that
|
||||
cannot answer from a window alone always return ``None``; callers
|
||||
fall back to :meth:`is_reasoning_end_streaming`.
|
||||
"""
|
||||
return None
|
||||
|
||||
@abstractmethod
|
||||
def extract_content_ids(self, input_ids: list[int]) -> list[int]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user