Skip to main content

Module tool_extractor

Module tool_extractor 

Source
Expand description

Streaming tool call extractor for instruction-tuned models.

When a model emits <tool_call>...</tool_call> blocks in its text output (because tools were injected via XML into the system prompt), this module provides a streaming state machine that detects those blocks and converts them into proper NormalizedEvent tool call events.

Structsยง

ToolCallExtractor
Streaming state machine that detects <tool_call> blocks in text deltas and converts them into NormalizedEvent tool call events.