Skip to main content

Module tool_parser

Module tool_parser 

Source
Expand description

Legacy parser for text-based tool calls from DeepSeek models.

Structured tool-call items are preferred, so the engine no longer invokes this parser. It is kept for reference/debugging.

Some DeepSeek outputs tool calls as text in various formats:

[TOOL_CALL]
{tool => "tool_name", args => {...}}
[/TOOL_CALL]

Or XML-style format:

<deepseek:tool_call>
<invoke name="tool_name">
<parameter name="arg">value</parameter>
</invoke>
</deepseek:tool_call>

This module parses these text patterns into structured tool calls.

Structs§

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

Functions§

has_tool_call_markers
Check if text contains tool call markers (either format).
parse_tool_calls
Parse tool calls from text content. Returns the clean text (with markers removed) and any parsed tool calls.