pub struct StructuredTool<T: Tool> { /* private fields */ }Expand description
Structured tool wrapper.
Wraps a Tool trait implementation as BaseTool, automatically handling JSON input parsing and output serialization.
Implementations§
Trait Implementations§
Source§impl<T: Tool> BaseTool for StructuredTool<T>
impl<T: Tool> BaseTool for StructuredTool<T>
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns the tool description. Read more
Source§fn run<'life0, 'async_trait>(
&'life0 self,
input: String,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
input: String,
) -> Pin<Box<dyn Future<Output = Result<String, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool (string version). Read more
Source§fn return_direct(&self) -> bool
fn return_direct(&self) -> bool
Whether to return result directly to user. Read more
Source§fn handle_error<'life0, 'async_trait>(
&'life0 self,
error: ToolError,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_error<'life0, 'async_trait>(
&'life0 self,
error: ToolError,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle execution error. Read more
Source§fn risk(&self) -> ToolRiskProfile
fn risk(&self) -> ToolRiskProfile
Declared Rule-of-Two risk profile (A2, v0.22.1). Read more
Auto Trait Implementations§
impl<T> Freeze for StructuredTool<T>where
T: Freeze,
impl<T> RefUnwindSafe for StructuredTool<T>where
T: RefUnwindSafe,
impl<T> Send for StructuredTool<T>
impl<T> Sync for StructuredTool<T>
impl<T> Unpin for StructuredTool<T>where
T: Unpin,
impl<T> UnsafeUnpin for StructuredTool<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for StructuredTool<T>where
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