pub struct ToolRegistry { /* private fields */ }Expand description
A registry of tools, shared cheaply via Arc<dyn Tool>.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register<T: Tool + 'static>(&mut self, tool: T) -> &mut Self
pub fn register<T: Tool + 'static>(&mut self, tool: T) -> &mut Self
Register a tool. Re-registering the same name replaces the tool.
Register a pre-shared tool.
Sourcepub fn schemas(&self) -> Vec<Value>
pub fn schemas(&self) -> Vec<Value>
OpenAI-format tool schemas for the chat API, one per registered tool:
{"type": "function", "function": {"name", "description", "parameters"}}.
Pass directly as the tools argument of
crate::llm::ChatModel::chat.
Trait Implementations§
Source§impl Clone for ToolRegistry
impl Clone for ToolRegistry
Source§impl Debug for ToolRegistry
impl Debug for ToolRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Freeze for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
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