Skip to main content

TypedTool

Trait TypedTool 

Source
pub trait TypedTool: Send + Sync {
    type Args: DeserializeOwned;
    type Output: Serialize;

    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn parameters_schema(&self) -> Value;
    fn call_typed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: Self::Args,
        ctx: &'life1 ToolContext,
    ) -> Pin<Box<dyn Future<Output = AgentResult<Self::Output>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn control_flow() -> ToolControlFlow
       where Self: Sized { ... }
    fn format_output(&self, output: Self::Output) -> String { ... }
}

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn description(&self) -> &'static str

Source

fn parameters_schema(&self) -> Value

Source

fn call_typed<'life0, 'life1, 'async_trait>( &'life0 self, args: Self::Args, ctx: &'life1 ToolContext, ) -> Pin<Box<dyn Future<Output = AgentResult<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn control_flow() -> ToolControlFlow
where Self: Sized,

Source

fn format_output(&self, output: Self::Output) -> String

Implementors§