create_tool

Function create_tool 

Source
pub fn create_tool<F, Fut>(
    name: impl Into<String>,
    description: impl Into<String>,
    handler: F,
) -> Arc<dyn Tool>
where F: Fn(Value) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<String, Error>> + Send + 'static,
Available on crate feature toolkit only.
Expand description

Simple helper to create a tool from an async closure (backwards compatibility) This is a simpler API for basic tools that don’t need explicit parameter schemas. The schema will be inferred as accepting any JSON object.