[PARSER][Mistral] unified engine-based parser for reasoning and tool calls (#48947)
This commit is contained in:
@@ -40,6 +40,7 @@ from vllm.parser.engine.adapters import (
|
||||
ParserEngineReasoningAdapter,
|
||||
ParserEngineToolAdapter,
|
||||
)
|
||||
from vllm.parser.mistral import MistralParser
|
||||
|
||||
_TOOLS_VALIDATOR = TypeAdapter(list[ChatCompletionToolsParam])
|
||||
|
||||
@@ -84,6 +85,11 @@ def _discover_pairings() -> list[_PairingInfo]:
|
||||
for engine_cls, adapters in engines.items():
|
||||
if "tool" not in adapters or "reasoning" not in adapters:
|
||||
continue
|
||||
if engine_cls is MistralParser:
|
||||
# Mistral uses brace-balanced JSON tool args with no TOOL_END
|
||||
# token, so it does not fit this TOOL_END-based replay harness.
|
||||
# It is covered by tests/parser/mistral/ instead.
|
||||
continue
|
||||
cfg = engine_cls(bare_tok, None).parser_engine_config
|
||||
if cfg.name not in _BUILDERS:
|
||||
missing_builders.append(f"{engine_cls.__name__} (config.name={cfg.name!r})")
|
||||
|
||||
@@ -34,6 +34,7 @@ from tests.parser.engine.trace_builder import _BUILDERS, build_samples
|
||||
from vllm.parser.engine import registered_adapters as _adapters_mod
|
||||
from vllm.parser.engine.parser_engine import ParserEngine
|
||||
from vllm.parser.engine.parser_engine_config import ParserState
|
||||
from vllm.parser.mistral import MistralParser
|
||||
|
||||
# ── Parser discovery ─────────────────────────────────────────────────
|
||||
|
||||
@@ -64,6 +65,11 @@ def _discover_parsers() -> list[_ParserInfo]:
|
||||
and obj is not ParserEngine
|
||||
):
|
||||
continue
|
||||
if obj is MistralParser:
|
||||
# Mistral uses brace-balanced JSON tool args with no TOOL_END
|
||||
# token, so it does not fit this TOOL_END-based replay harness.
|
||||
# It is covered by tests/parser/mistral/ instead.
|
||||
continue
|
||||
cfg = obj(bare_tok, None).parser_engine_config
|
||||
if cfg.name not in _BUILDERS:
|
||||
missing_builders.append(f"{obj.__name__} (config.name={cfg.name!r})")
|
||||
|
||||
Reference in New Issue
Block a user