Skip to main content

tool

Function tool 

Source
pub fn tool<A, F, Fut>(
    name: &str,
    description: &str,
    f: F,
) -> impl Tool + 'static
where A: DeserializeOwned + JsonSchema + Send + 'static, F: Fn(A) -> Fut + Send + Sync + 'static, Fut: Future + Send + 'static, Fut::Output: IntoToolOutput,
Expand description

Builds a tool from argument type A and async fn f, without a macro. f takes the parsed arguments and returns any IntoToolOutput value; name and description are what the model sees. The schema is the same one typed_tool derives from A.