pub struct EmbeddingMatcher<E: Embeddings> { /* private fields */ }Expand description
Matches entities by computing embedding similarity between the query and entity representations (name + type + description).
Requires an Embeddings implementation to compute vectors. Embeddings
are cached internally to avoid recomputation across calls.
Implementations§
Source§impl<E: Embeddings> EmbeddingMatcher<E>
impl<E: Embeddings> EmbeddingMatcher<E>
Sourcepub fn new(embeddings: E) -> Self
pub fn new(embeddings: E) -> Self
Creates a new embedding matcher with the given embeddings backend.
Sourcepub fn with_min_score(self, min_score: f64) -> Self
pub fn with_min_score(self, min_score: f64) -> Self
Sets the minimum embedding-similarity threshold (P1-2), default 0.0 keeps the old behavior.
Source§impl<E: Embeddings + 'static> EmbeddingMatcher<E>
impl<E: Embeddings + 'static> EmbeddingMatcher<E>
Sourcepub async fn find_relevant_async(
&self,
query: &str,
store: &GraphStore,
top_k: usize,
) -> Result<Vec<String>, GraphRAGError>
pub async fn find_relevant_async( &self, query: &str, store: &GraphStore, top_k: usize, ) -> Result<Vec<String>, GraphRAGError>
Async version of entity matching using embeddings.
This is the preferred method when using embedding-based matching, since embedding computation is inherently async.
P0-2: no more silent degradation / silent 0 scores — embedding failures or vector dimension mismatches now error out explicitly, letting callers know semantic matching is unavailable or the data is defective, instead of quietly falling back to keyword or treating “dimension mismatch” as “dissimilar”.
Trait Implementations§
Source§impl<E: Embeddings + 'static> EntityMatcher for EmbeddingMatcher<E>
impl<E: Embeddings + 'static> EntityMatcher for EmbeddingMatcher<E>
Source§fn find_relevant(
&self,
query: &str,
_store: &GraphStore,
_top_k: usize,
) -> Vec<String>
fn find_relevant( &self, query: &str, _store: &GraphStore, _top_k: usize, ) -> Vec<String>
top_k results.