Expand description
Tool calling: format detection and per-model response parsing.
Prompt formatting is handled by HuggingFace chat templates (the tools variable
is passed to the template engine). This module handles the output side:
detecting and parsing tool calls from model responses in various formats.
Enums§
- Tool
Call Format - Tool-call output format used by a model family.
Functions§
- extract_
text_ content - Extract text content from response, removing Qwen3 tool call XML tags.
- extract_
text_ content_ for_ format - Extract text content from response, removing tool call markers for the given format.
- has_
qwen35_ xml_ tool_ calls - Detect whether text contains Qwen3.5 XML parameter-style tool calls.
- has_
tool_ calls - Check if text contains Qwen3 tool calls.
- has_
tool_ calls_ for_ format - Check if text contains tool calls in the given format.
- parse_
llama_ tool_ calls - Parse Llama 3.1+ tool calls.
- parse_
mistral_ tool_ calls - Parse Mistral tool calls.
- parse_
qwen3_ tool_ calls - Parse Qwen3 XML tool calls from model output and convert to OpenAI format.
- parse_
qwen35_ xml_ tool_ calls - Parse Qwen3.5 XML parameter-style tool calls from model output.
- parse_
tool_ calls_ for_ format - Parse tool calls from model output using the given format.