pub struct EmbeddingEntityResolver<E, C> { /* private fields */ }Expand description
Resolves entities by cosine similarity over candidate embeddings.
The production impl: embeds the candidate string and compares it against the
embeddings of existing nodes in the same scope, merging into the closest node
above MIN_ENTITY_SIMILARITY. This collapses surface-form variants onto one
node where the exact-string resolver would fragment them.
Candidate embeddings are stored as a node property and scanned exactly here;
a FalkorDB-native vector index can later replace the catalog’s linear scan
behind the EntityCatalog seam without changing this resolver.
Generic over the embedder and catalog so tests inject stubs.
Implementations§
Source§impl<E: EmbeddingModel, C: EntityCatalog> EmbeddingEntityResolver<E, C>
impl<E: EmbeddingModel, C: EntityCatalog> EmbeddingEntityResolver<E, C>
Sourcepub fn new(embedder: E, catalog: C) -> Self
pub fn new(embedder: E, catalog: C) -> Self
Builds a resolver over embedder and catalog with the default floor.
Sourcepub fn with_min_similarity(self, min_similarity: f32) -> Self
pub fn with_min_similarity(self, min_similarity: f32) -> Self
Overrides the minimum cosine similarity for a match.
Trait Implementations§
Source§impl<E: EmbeddingModel, C: EntityCatalog> EntityResolver for EmbeddingEntityResolver<E, C>
impl<E: EmbeddingModel, C: EntityCatalog> EntityResolver for EmbeddingEntityResolver<E, C>
Source§async fn resolve(
&self,
scope: &Scope,
entity: &str,
) -> Result<Resolution, ResolveError>
async fn resolve( &self, scope: &Scope, entity: &str, ) -> Result<Resolution, ResolveError>
Auto Trait Implementations§
impl<E, C> Freeze for EmbeddingEntityResolver<E, C>
impl<E, C> RefUnwindSafe for EmbeddingEntityResolver<E, C>where
E: RefUnwindSafe,
C: RefUnwindSafe,
impl<E, C> Send for EmbeddingEntityResolver<E, C>
impl<E, C> Sync for EmbeddingEntityResolver<E, C>
impl<E, C> Unpin for EmbeddingEntityResolver<E, C>
impl<E, C> UnsafeUnpin for EmbeddingEntityResolver<E, C>where
E: UnsafeUnpin,
C: UnsafeUnpin,
impl<E, C> UnwindSafe for EmbeddingEntityResolver<E, C>where
E: UnwindSafe,
C: UnwindSafe,
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request