pub fn parse_qwen3_tool_calls(text: &str) -> Result<Vec<ToolCall>, Error>Expand description
Parse Qwen3 XML tool calls from model output and convert to OpenAI format.
Uses delimiter-based extraction instead of a single regex so that nested
JSON braces inside arguments are handled correctly. Handles malformed
output where the model emits duplicate <tool_call> tags by searching
backward from </tool_call> to find the nearest <tool_call> (and also
skipping blocks that don’t contain valid JSON).