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.
Source code in vllm/parser/muse.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | |
_header_ends_reasoning(input_ids, pos)
¶
True for a tool message, False for another role's message, else None.
Source code in vllm/parser/muse.py
_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.
Source code in vllm/parser/muse.py
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.