vllm.parser.glm47_moe
¶
GLM-4.7 parser for reasoning and tool calls.
GLM-4.7 uses XML-like tool calls::
<tool_call>func_name<arg_key>key</arg_key><arg_value>value</arg_value></tool_call>
The function name can be followed directly by the first <arg_key> tag,
and tool calls may have no arguments.
Classes:
-
Glm47MoeParser–GLM-4.7 parser backed by the declarative parser engine.
Glm47MoeParser
¶
Bases: ParserEngine
GLM-4.7 parser backed by the declarative parser engine.
Source code in vllm/parser/glm47_moe.py
_ClosedArgs
¶
Closed key/value pairs of a raw argument text, reused by longer texts.
Raw arguments only grow while a call streams, so a parse of a text that
extends text resumes after its last closed value.
Source code in vllm/parser/glm47_moe.py
_closed_args(text, pos)
¶
Yield (start, key, value, end) for each closed argument from pos.
Source code in vllm/parser/glm47_moe.py
_find_arg(text, pos)
¶
Locate the first argument whose key starts at or after pos.
Returns the start and end of the key and the start of the value. The key
runs to the first </arg_key> that is followed by <arg_value>. When
the first <arg_key> has no such end, no later one has either, so each
call scans the text once.
Source code in vllm/parser/glm47_moe.py
_glm47_parse_args(raw_args, partial, closed=None)
¶
Return the arguments and the key of the open trailing value, if any.