Skip to main content

parse_tool_calls

Function parse_tool_calls 

Source
pub fn parse_tool_calls(text: &str) -> (String, Vec<ToolCall>)
Expand description

Find all <|tool_call>…<tool_call|> blocks, parse them, and return:

  • clean: the input text with every block that parsed removed, and the channel markers. A block that does not parse (or has no closing marker) stays in clean verbatim, as in parse_hermes_tool_calls. Whitespace is kept, except that where a removed block had whitespace on both sides only one gap survives (see parse_hermes_tool_calls).
  • the parsed ToolCall list.