Skip to main content

Module tool_parser

Module tool_parser 

Source
Expand description

Robust tool call parser with XML and JSON fallback

Handles multiple formats for tool calls:

  1. Native function calling (tool_calls in response)
  2. XML-style blocks
  3. JSON code blocks with tool schema
  4. Markdown code blocks with tool invocations

Structs§

ParseResult
Result of parsing content for tool calls
ParsedToolCall
A parsed tool call

Enums§

ParseMethod
How the tool call was parsed

Functions§

extract_text_only
Extract just the text content from a response, removing tool calls
parse_tool_calls
Parse content for tool calls using multiple strategies
validate_tool_call
Validate that a parsed tool call has the required structure