pub struct ToolSchemaFilter { /* private fields */ }Expand description
Core filter holding cached tool embeddings and config.
Implementations§
Source§impl ToolSchemaFilter
impl ToolSchemaFilter
Sourcepub fn new(
always_on: Vec<String>,
top_k: usize,
min_description_words: usize,
embeddings: Vec<ToolEmbedding>,
) -> Self
pub fn new( always_on: Vec<String>, top_k: usize, min_description_words: usize, embeddings: Vec<ToolEmbedding>, ) -> Self
Create a new filter with pre-computed tool embeddings.
Sourcepub fn embedding_count(&self) -> usize
pub fn embedding_count(&self) -> usize
Number of cached tool embeddings.
Sourcepub fn always_on_count(&self) -> usize
pub fn always_on_count(&self) -> usize
Number of always-on tools in the filter config.
Sourcepub fn recompute(&mut self, embeddings: Vec<ToolEmbedding>)
pub fn recompute(&mut self, embeddings: Vec<ToolEmbedding>)
Replace tool embeddings (e.g. after MCP tool changes) and bump version.
Sourcepub fn filter(
&self,
all_tool_ids: &[&str],
tool_descriptions: &[(&str, &str)],
query: &str,
query_embedding: &[f32],
) -> ToolFilterResult
pub fn filter( &self, all_tool_ids: &[&str], tool_descriptions: &[(&str, &str)], query: &str, query_embedding: &[f32], ) -> ToolFilterResult
Filter tools for a given user query embedding.
all_tool_ids is the full set of tool IDs currently available.
tool_descriptions maps tool ID to its description (for short-description check).
query_embedding is the embedded user query.
Auto Trait Implementations§
impl Freeze for ToolSchemaFilter
impl RefUnwindSafe for ToolSchemaFilter
impl Send for ToolSchemaFilter
impl Sync for ToolSchemaFilter
impl Unpin for ToolSchemaFilter
impl UnsafeUnpin for ToolSchemaFilter
impl UnwindSafe for ToolSchemaFilter
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