vllm.parser.engine.adapters
¶
Adapters that expose ParserEngine through the legacy
ReasoningParser and ToolParser interfaces.
This lets parser engines flow through the existing serving-layer code paths that expect separate reasoning and tool parser instances, without any changes to the serving layer itself.
Classes:
-
ParserEngineReasoningAdapter–Adapts a
ParserEngineto theReasoningParser -
ParserEngineToolAdapter–Adapts a
ParserEngineto theToolParserinterface.
ParserEngineReasoningAdapter
¶
Bases: ReasoningParser
Adapts a ParserEngine to the ReasoningParser
interface so parser engines can be used as reasoning parsers in the
existing serving code.
Subclasses set _parser_engine_cls to the concrete
ParserEngine class.
Attributes:
-
opens_reasoning_in_content(bool) –Whether the grammar can open reasoning after content has started.
opens_reasoning_in_content
property
¶
Whether the grammar can open reasoning after content has started.
ParserEngineToolAdapter
¶
Bases: ToolParser
Adapts a ParserEngine to the ToolParser interface.
extract_tool_calls starts the parser engine in CONTENT
state so it can parse reasoning-stripped content (i.e. the output of
ReasoningParser.extract_reasoning).
When no reasoning parser is configured at the serving layer, the
owning Parser sets
skip_reasoning_parsing so reasoning markup — plain content
in that configuration — passes through verbatim instead of being
consumed or reclassified by the engine. The engine honors the flag
only for markers that are reasoning-exclusive in its config; a
grammar like Inkling, whose block closer is shared with text and
tool blocks, keeps parsing unchanged.
Subclasses set _parser_engine_cls to the concrete
ParserEngine class.