vllm.tool_parsers.lfm2_tool_parser
¶
Classes:
-
Lfm2ToolParser–Tool call parser for LiquidAI LFM2/LFM2.5 models that produce pythonic
Lfm2ToolParser
¶
Bases: ToolParser
Tool call parser for LiquidAI LFM2/LFM2.5 models that produce pythonic tool calls wrapped in <|tool_call_start|> and <|tool_call_end|> tokens.
Example model output
<|tool_call_start|>[get_weather(location="Paris")]<|tool_call_end|> The weather in Paris is sunny.
Used when --enable-auto-tool-choice --tool-call-parser lfm2 are all set.
_extract_tool_call_text(model_output)
classmethod
¶
Extract the pythonic call text and surrounding content.
Returns (tool_text, content) where tool_text is the text between the sentinel tokens and content is everything outside them.
_restore_reserved(tool_call)
staticmethod
¶
Restore parameter names renamed by rename_reserved_kwargs.
_strip_echo(raw_after)
staticmethod
¶
Drop any orphan <|tool_call_end|> (and the preceding text) from trailing content. LFM2 occasionally echoes the call body after the first end token and caps it with a second end token; everything through the last such orphan is model garbage, not user content.