pub struct ToolSelector { /* private fields */ }Expand description
Selects 3–5 relevant tools per task using TF-IDF-style word-overlap (Jaccard) similarity.
§Selection rules
- Compute Jaccard similarity between the intent query and each tool description.
- Sort tools by descending similarity score.
- Return between 3 and min(5, tool_count) tools.
- If no tool has similarity > threshold, return the default tool set instead.
Implementations§
Source§impl ToolSelector
impl ToolSelector
Sourcepub fn new(_model_path: &Path, preset: &Preset) -> Result<Self>
pub fn new(_model_path: &Path, preset: &Preset) -> Result<Self>
Create a new ToolSelector from a Preset.
model_path is accepted for API compatibility but is unused because we use
a TF-IDF/Jaccard approach rather than a neural embedding model.
Sourcepub fn register_tools(&mut self, tools: &[ToolDefinition]) -> Result<()>
pub fn register_tools(&mut self, tools: &[ToolDefinition]) -> Result<()>
Register a slice of tools, computing bag-of-words for each description.
Sourcepub fn select(&self, intent: &str, max_tools: usize) -> Result<Vec<ToolId>>
pub fn select(&self, intent: &str, max_tools: usize) -> Result<Vec<ToolId>>
Select between 3 and min(5, tool_count) tools whose descriptions best match intent.
Returns the default tool set when no tool exceeds the similarity threshold.
Sourcepub fn update_tool(&mut self, tool: &ToolDefinition) -> Result<()>
pub fn update_tool(&mut self, tool: &ToolDefinition) -> Result<()>
Re-embed a single tool on description change.
Auto Trait Implementations§
impl Freeze for ToolSelector
impl RefUnwindSafe for ToolSelector
impl Send for ToolSelector
impl Sync for ToolSelector
impl Unpin for ToolSelector
impl UnsafeUnpin for ToolSelector
impl UnwindSafe for ToolSelector
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