pub struct FunctionTool<T, F>where
T: DeserializeOwned + Send + Sync + 'static,
F: Fn(T) -> Pin<Box<dyn Future<Output = Result<String>> + Send>> + Send + Sync,{ /* private fields */ }Expand description
A tool implementation using a function
Implementations§
Source§impl<T, F> FunctionTool<T, F>
impl<T, F> FunctionTool<T, F>
Trait Implementations§
Source§impl<T, F> Tool for FunctionTool<T, F>
impl<T, F> Tool for FunctionTool<T, F>
Source§fn description(&self) -> &str
fn description(&self) -> &str
Get the tool description
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
Get the tool definition (JSON Schema)
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments
Source§fn ephemeral(&self) -> EphemeralConfig
fn ephemeral(&self) -> EphemeralConfig
Whether tool outputs should be ephemeral (removed from context after use)
Auto Trait Implementations§
impl<T, F> Freeze for FunctionTool<T, F>where
F: Freeze,
impl<T, F> RefUnwindSafe for FunctionTool<T, F>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F> Send for FunctionTool<T, F>
impl<T, F> Sync for FunctionTool<T, F>
impl<T, F> Unpin for FunctionTool<T, F>
impl<T, F> UnsafeUnpin for FunctionTool<T, F>where
F: UnsafeUnpin,
impl<T, F> UnwindSafe for FunctionTool<T, F>where
F: UnwindSafe,
T: 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