pub struct SimpleTool<F>where
F: Fn(Value) -> Pin<Box<dyn Future<Output = Result<ToolResult, Box<dyn Error + Send + Sync>>> + Send>> + Send + Sync,{ /* private fields */ }
Expand description
Simple function wrapper for tool functions.
This allows you to register simple async functions as tools without
implementing the full ToolFunction
trait.
Implementations§
Trait Implementations§
Source§impl<F> ToolFunction for SimpleTool<F>
impl<F> ToolFunction for SimpleTool<F>
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with the given input. Read more
Source§fn validate_input(
&self,
_input: &Value,
) -> Result<(), Box<dyn Error + Send + Sync>>
fn validate_input( &self, _input: &Value, ) -> Result<(), Box<dyn Error + Send + Sync>>
Validate input before execution (optional). Read more
Source§fn timeout_seconds(&self) -> u64
fn timeout_seconds(&self) -> u64
Get the tool’s timeout in seconds (optional). Read more
Auto Trait Implementations§
impl<F> Freeze for SimpleTool<F>where
F: Freeze,
impl<F> RefUnwindSafe for SimpleTool<F>where
F: RefUnwindSafe,
impl<F> Send for SimpleTool<F>
impl<F> Sync for SimpleTool<F>
impl<F> Unpin for SimpleTool<F>where
F: Unpin,
impl<F> UnwindSafe for SimpleTool<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more