pub struct Registry { /* private fields */ }Expand description
A collection of tools with name-based dispatch.
The Agent holds a Registry and uses it to dispatch
tool calls from the model. Tools can be registered at any time before
or between calls to Agent::step.
Implementations§
Source§impl Registry
impl Registry
pub fn new() -> Self
pub fn register(&mut self, tool: Box<dyn Tool>)
Sourcepub fn register_typed<T: TypedTool + 'static>(&mut self, tool: T)
pub fn register_typed<T: TypedTool + 'static>(&mut self, tool: T)
Register a TypedTool directly, wrapping it in an ErasedAdapter.
pub fn dispatch(&self, name: &str, args: Value) -> Result<String, String>
pub fn names(&self) -> Vec<&str>
pub fn as_openai_tools(&self) -> Value
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl !UnwindSafe for Registry
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