[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
+3 -3
View File
@@ -27,7 +27,7 @@ if TYPE_CHECKING:
ChatCompletionRequest,
)
from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
from vllm.parser.engine.parser_engine import ParserEngine
from vllm.parser.engine.parser_engine import ParserEngine, ReasoningEnd
from vllm.tokenizers import TokenizerLike
from vllm.tool_parsers.utils import Tool
@@ -65,8 +65,8 @@ class ParserEngineReasoningAdapter(ReasoningParser):
def is_reasoning_end(self, input_ids: Sequence[int]) -> bool:
return self._parser_engine.is_reasoning_end(list(input_ids))
def find_reasoning_end_offset(self, token_ids: Sequence[int]) -> int | None:
return self._parser_engine.find_reasoning_end_offset(token_ids)
def find_reasoning_end(self, token_ids: Sequence[int]) -> ReasoningEnd | None:
return self._parser_engine.find_reasoning_end(token_ids)
def adjust_initial_state_from_prompt(self, prompt_token_ids: Sequence[int]) -> None:
self._parser_engine.adjust_initial_state_from_prompt(prompt_token_ids)