pub struct ClosureTool { /* private fields */ }Expand description
A simple tool implemented as a closure.
Implementations§
Trait Implementations§
Source§impl BaseTool for ClosureTool
impl BaseTool for ClosureTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
A description of what the tool does.
Source§fn parameters(&self) -> Option<&JsonValue>
fn parameters(&self) -> Option<&JsonValue>
The JSON schema for the tool’s parameters.
Source§fn invoke(
&self,
args: &JsonValue,
_config: &RunnableConfig,
) -> Result<JsonValue, ToolError>
fn invoke( &self, args: &JsonValue, _config: &RunnableConfig, ) -> Result<JsonValue, ToolError>
Invoke the tool synchronously with the given arguments.
Source§fn ainvoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
args: &'life1 JsonValue,
config: &'life2 RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<JsonValue, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ainvoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
args: &'life1 JsonValue,
config: &'life2 RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<JsonValue, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Invoke the tool asynchronously. Default delegates to sync invoke via block_in_place. Read more
Source§fn to_tool_def(&self) -> ToolDef
fn to_tool_def(&self) -> ToolDef
Get the tool’s schema as a ToolCall-compatible descriptor.
Auto Trait Implementations§
impl !RefUnwindSafe for ClosureTool
impl !UnwindSafe for ClosureTool
impl Freeze for ClosureTool
impl Send for ClosureTool
impl Sync for ClosureTool
impl Unpin for ClosureTool
impl UnsafeUnpin for ClosureTool
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