vllm.parser.muse
¶
Muse Spark parser: recipient-routed messages parsed by one state machine.
Muse Spark writes an assistant turn as a sequence of messages::
to=self<|message|>...reasoning...<|eom|><|start|>assistant
to=get_weather<|message|><atem:function_calls>
<atem:invoke name="get_weather">
<atem:parameter name="city">Paris</atem:parameter>
</atem:invoke>
</atem:function_calls><|eom|><|start|>assistant
to=user<|message|>...final answer...<|eot|>
The recipient before <|message|> routes each body: self or none is
reasoning, user and commentary are content, developer is dropped, and
any other recipient is a tool. The model may write to=NAME<|message|> right
after a body without <|eom|>, so a trailing to=NAME in a body is held back.
Classes:
MuseParser
¶
Bases: ParserEngine
Methods:
-
count_reasoning_tokens–Count reasoning-body tokens from the ids alone.
_header_ends_reasoning(input_ids, pos)
¶
True for a tool message, False for another role's message, else None.
_registered_name(name)
¶
Map NAME.<suffix> back to a registered bare NAME.
The chat template renders a bare tool as "NAME.*", so the model may
fill in any suffix (Bash.Bash, Bash.command, Glob.). The doubled
form always collapses; other suffixes collapse only when no registered
name lives under NAME., where the suffix may name a missing sibling.
count_reasoning_tokens(token_ids)
¶
Count reasoning-body tokens from the ids alone.
Counting streamed text events undercounts when the detokenizer holds text back (stop strings, partial UTF-8) while ids advance.