pub trait CallableFunction: Send + Sync {
// Required methods
fn declaration(&self) -> FunctionDeclaration;
fn call<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, FunctionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A trait for functions that can be called by the model.
Required Methods§
Sourcefn declaration(&self) -> FunctionDeclaration
fn declaration(&self) -> FunctionDeclaration
Returns the declaration of the function.
Sourcefn call<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, FunctionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, FunctionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes the function with the given arguments. The arguments are provided as a serde_json::Value, and the function should return a serde_json::Value.