pub struct ToolBuilder { /* private fields */ }
Expand description
Builder for creating tools from async functions
Implementations§
Source§impl ToolBuilder
impl ToolBuilder
Sourcepub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Start building a new tool with the given name and description
Sourcepub fn with_parameters(self, parameters: ToolParameterSchema) -> Self
pub fn with_parameters(self, parameters: ToolParameterSchema) -> Self
Set the parameter schema for this tool
Sourcepub fn build_async<F, Fut>(self, handler: F) -> ToolBoxwhere
F: Fn(Value, ToolContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ToolResult>> + Send + 'static,
pub fn build_async<F, Fut>(self, handler: F) -> ToolBoxwhere
F: Fn(Value, ToolContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ToolResult>> + Send + 'static,
Build the tool with an async handler function
Sourcepub fn build_sync<F>(self, handler: F) -> ToolBox
pub fn build_sync<F>(self, handler: F) -> ToolBox
Build the tool with a sync handler function
Auto Trait Implementations§
impl Freeze for ToolBuilder
impl RefUnwindSafe for ToolBuilder
impl Send for ToolBuilder
impl Sync for ToolBuilder
impl Unpin for ToolBuilder
impl UnwindSafe for ToolBuilder
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