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>,
) -> ToolBuilder
Available on crate feature toolkit only.
pub fn new( name: impl Into<String>, description: impl Into<String>, ) -> ToolBuilder
toolkit only.Start building a new tool with the given name and description
Sourcepub fn with_parameters(self, parameters: ToolParameterSchema) -> ToolBuilder
Available on crate feature toolkit only.
pub fn with_parameters(self, parameters: ToolParameterSchema) -> ToolBuilder
toolkit only.Set the parameter schema for this tool
Sourcepub fn build_async<F, Fut>(self, handler: F) -> Arc<dyn Tool>where
F: Fn(Value, ToolContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ToolResult, Error>> + Send + 'static,
Available on crate feature toolkit only.
pub fn build_async<F, Fut>(self, handler: F) -> Arc<dyn Tool>where
F: Fn(Value, ToolContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<ToolResult, Error>> + Send + 'static,
toolkit only.Build the tool with an async handler function
Sourcepub fn build_sync<F>(self, handler: F) -> Arc<dyn Tool>
Available on crate feature toolkit only.
pub fn build_sync<F>(self, handler: F) -> Arc<dyn Tool>
toolkit only.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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.