Skip to main content

ToolSet

Trait ToolSet 

Source
pub trait ToolSet: Send + Sync {
    // Required methods
    fn specs(&self) -> &[ToolSpec];
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        input: Value,
        ctx: &'life2 ToolContext,
    ) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}

Required Methods§

Source

fn specs(&self) -> &[ToolSpec]

Tool specifications the LLM sees in CompletionRequest.tools.

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, name: &'life1 str, input: Value, ctx: &'life2 ToolContext, ) -> Pin<Box<dyn Future<Output = ToolOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute a tool by name. name is guaranteed to be one returned from specs() by the caller; implementations return ToolOutcome::ExecutionError if that invariant is violated.

Implementors§