pub struct ToolSet<C: BaseContext> {
pub set: BTreeMap<String, Box<dyn ToolDyn<C>>>,
}
Expand description
Collection of tools that can be used by the AI Agent
§Type Parameters
C
: The context type that implementsBaseContext
.
Fields§
§set: BTreeMap<String, Box<dyn ToolDyn<C>>>
Implementations§
Source§impl<C> ToolSet<C>
impl<C> ToolSet<C>
Sourcepub fn contains(&self, name: &str) -> bool
pub fn contains(&self, name: &str) -> bool
Checks if a tool with the given name exists in the set
Sourcepub fn definition(&self, name: &str) -> Option<FunctionDefinition>
pub fn definition(&self, name: &str) -> Option<FunctionDefinition>
Retrieves definition for a specific agent.
Sourcepub fn definitions(&self, names: Option<&[&str]>) -> Vec<FunctionDefinition>
pub fn definitions(&self, names: Option<&[&str]>) -> Vec<FunctionDefinition>
Returns definitions for all or specified tools.
§Arguments
names
: Optional slice of agent names to filter by.
§Returns
- Vec<
FunctionDefinition
>: Vector of agent definitions.
Sourcepub fn select_resources(
&self,
name: &str,
resources: &mut Vec<Resource>,
) -> Vec<Resource>
pub fn select_resources( &self, name: &str, resources: &mut Vec<Resource>, ) -> Vec<Resource>
Extracts resources from the provided list based on the tool’s supported tags.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for ToolSet<C>
impl<C> !RefUnwindSafe for ToolSet<C>
impl<C> Send for ToolSet<C>
impl<C> Sync for ToolSet<C>
impl<C> Unpin for ToolSet<C>
impl<C> !UnwindSafe for ToolSet<C>
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 more