Skip to main content

rpc_agent/
tools.rs

1use rig::tool::Tool;
2
3use crate::Error;
4
5#[derive(Clone)]
6pub struct ToolWrapper<T: Tool + 'static>(Box<T>);
7
8impl<T: Tool + 'static> ToolWrapper<T> {
9    pub fn new(tool: T) -> Self {
10        Self(Box::new(tool))
11    }
12    pub fn tool(self) -> Box<T> {
13        self.0
14    }
15}
16
17pub struct NoTool;
18
19impl Tool for NoTool {
20    const NAME: &'static str = "";
21
22    type Error = Error;
23    type Args = ();
24    type Output = ();
25
26    async fn definition(&self, _prompt: String) -> rig::completion::ToolDefinition {
27        unreachable!("NoTool should never be used");
28    }
29
30    async fn call(&self, _args: Self::Args) -> Result<Self::Output, Self::Error> {
31        unreachable!("NoTool should never be used");
32    }
33}