Skip to content

vllm.parser.engine.parser_engine_config

Declarative configuration for model tool-call and reasoning formats.

Each model format is described by a ParserEngineConfig that specifies:

  • terminals – literal strings or regex patterns that delimit the format (e.g. <tool_call>, </think>).
  • token_id_terminals – terminals that should be matched by token ID rather than (or in addition to) text.
  • transitions – a state machine mapping (state, terminal) → (new_state, events_to_emit) that drives semantic event generation during streaming.
  • content_events – what EventType to emit for plain content (non-terminal text) in each state.

Classes:

  • ParserEngineConfig –

    Declarative description of a model's tool-call / reasoning format.

ParserEngineConfig dataclass

Declarative description of a model's tool-call / reasoning format.

The engine feeds terminals from the incremental lexer into the transition table and emits the corresponding semantic events. Content tokens (text between terminals) are classified by the current state via content_events.

Methods:

  • terminal_literal –

    Canonical spelling of terminal name, or None if undeclared.

Attributes:

terminal_literals property

Every declared spelling across all terminals.

terminal_literal(name)

Canonical spelling of terminal name, or None if undeclared.