pub struct ToolSet { /* private fields */ }Expand description
An ordered collection of tools.
Implementations§
Source§impl ToolSet
impl ToolSet
Sourcepub fn from_tools<T>(tools: Vec<T>) -> Selfwhere
T: Tool + 'static,
pub fn from_tools<T>(tools: Vec<T>) -> Selfwhere
T: Tool + 'static,
Build a set from homogeneous typed tools.
Sourcepub fn from_dynamic_tools(tools: Vec<DynamicTool>) -> Self
pub fn from_dynamic_tools(tools: Vec<DynamicTool>) -> Self
Build a set from runtime-defined tools.
Sourcepub fn add_tool<T>(&mut self, tool: T) -> Stringwhere
T: Tool + 'static,
pub fn add_tool<T>(&mut self, tool: T) -> Stringwhere
T: Tool + 'static,
Register a typed tool.
Sourcepub fn add_dynamic_tool(&mut self, tool: DynamicTool) -> String
pub fn add_dynamic_tool(&mut self, tool: DynamicTool) -> String
Register a runtime-defined tool.
Sourcepub fn add_portable_dynamic_tool(&mut self, tool: PortableDynamicTool) -> String
pub fn add_portable_dynamic_tool(&mut self, tool: PortableDynamicTool) -> String
Register a context-free dynamic tool without rewriting its callback.
Sourcepub fn add_retrieved_tool<T>(&mut self, tool: T) -> Stringwhere
T: ToolEmbedding + 'static,
pub fn add_retrieved_tool<T>(&mut self, tool: T) -> Stringwhere
T: ToolEmbedding + 'static,
Register a tool that is retrieved from an embedding index at prompt time.
The registration keeps the tool’s embedding context and documents, so
ToolSet::schemas can hand them to a vector store.
Sourcepub fn delete_tool(&mut self, name: &str)
pub fn delete_tool(&mut self, name: &str)
Delete a tool by name.
Sourcepub fn add_tools(&mut self, set: ToolSet)
pub fn add_tools(&mut self, set: ToolSet)
Merge another set, preserving registration order and replacing duplicates.
Sourcepub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
pub fn get_tool_definitions(&self) -> Vec<ToolDefinition>
Provider-facing definitions in registration order.
Sourcepub async fn execute(
&self,
name: &str,
args: impl Into<String>,
context: &mut ToolContext,
) -> ToolResult
pub async fn execute( &self, name: &str, args: impl Into<String>, context: &mut ToolContext, ) -> ToolResult
Execute one registered tool through the canonical structured path.
The tool receives a snapshot of inbound context. Result metadata is
published back to context; mutations to inbound values are discarded.
Sourcepub fn schemas(&self) -> Result<Vec<ToolSchema>, EmbedError>
pub fn schemas(&self) -> Result<Vec<ToolSchema>, EmbedError>
Convert embedding tools to vector-store schemas.