Skip to main content

ToolCallParser

Trait ToolCallParser 

Source
pub trait ToolCallParser: Send + Sync {
    // Required method
    fn parse<'life0, 'life1, 'async_trait>(
        &'life0 self,
        response: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Vec<ToolCall>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for parsing tool calls out of a raw model response.

The default implementation looks for <tool_call>…</tool_call> JSON blocks. Register custom parsers via CascadeEngine::with_tool_parser.

Required Methods§

Source

fn parse<'life0, 'life1, 'async_trait>( &'life0 self, response: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<ToolCall>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Parse zero or more tool calls from a model response string.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§