Trait Tool

Source
pub trait Tool: BaseTool {
    // Required method
    fn invoke<'life0, 'async_trait>(
        &'life0 self,
        input: HashMap<String, Value>,
        config: Option<RunnableConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for tools that can be invoked with a single input

Required Methods§

Source

fn invoke<'life0, 'async_trait>( &'life0 self, input: HashMap<String, Value>, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the tool with the given input

Implementors§

Source§

impl<F> Tool for FunctionTool<F>
where F: Fn(HashMap<String, Value>) -> Result<String> + Send + Sync + 'static,