pub trait Tool: Send + Sync {
// Required methods
fn raw_tools(&self) -> Vec<RawTool>;
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Required Methods§
fn raw_tools(&self) -> Vec<RawTool>
Sourcefn call<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoke the named tool with the given arguments and return the result as a JSON value.
When using the #[tool] macro you do not implement this method yourself —
the macro generates it. The generated implementation accepts any return type
that implements serde::Serialize (including serde_json::Value, plain
structs with #[derive(Serialize)], primitives, etc.) and converts the
value to serde_json::Value automatically.