pub struct ToolWrapper<T: Tool + 'static>(/* private fields */);Expand description
Implementations§
Source§impl<T: Tool + 'static> ToolWrapper<T>
impl<T: Tool + 'static> ToolWrapper<T>
Sourcepub fn new(tool: T) -> Self
pub fn new(tool: T) -> Self
Creates a new ToolWrapper with the given struct that implements the Tool trait.
example:
ⓘ
use rpc_agent::tools::ToolWrapper;
use rig::tool::Tool;
struct MyTool;
impl Tool for MyTool {
const NAME: &'static str = "my_tool";
type Error = anyhow::Error;
type Args = ();
type Output = ();
async fn definition(&self, _prompt: String) -> rig::completion::ToolDefinition {
unreachable!("MyTool should never be used");
}
async fn call(&self, _args: Self::Args) -> Result<Self::Output, Self::Error> {
unreachable!("MyTool should never be used");
}
}
let tool = ToolWrapper::new(MyTool);Trait Implementations§
Source§impl<T: Clone + Tool + 'static> Clone for ToolWrapper<T>
impl<T: Clone + Tool + 'static> Clone for ToolWrapper<T>
Source§fn clone(&self) -> ToolWrapper<T>
fn clone(&self) -> ToolWrapper<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for ToolWrapper<T>
impl<T> RefUnwindSafe for ToolWrapper<T>where
T: RefUnwindSafe,
impl<T> Send for ToolWrapper<T>
impl<T> Sync for ToolWrapper<T>
impl<T> Unpin for ToolWrapper<T>
impl<T> UnsafeUnpin for ToolWrapper<T>
impl<T> UnwindSafe for ToolWrapper<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