Skip to main content

resolve_entity

Function resolve_entity 

Source
pub async fn resolve_entity(
    gm: &GraphMemory,
    llm: &dyn LlmProvider,
    candidate: &ExtractedEntity,
    session_id: &str,
) -> Result<Resolution, GraphError>
Expand description

Run the dedup pipeline for one extracted entity.

Three bands of raw cosine similarity, only one of which costs a model call:

  1. An existing entity of the same name and type — the same entity, resolved on an index lookup alone.
  2. Nearest neighbour at or above certain_similarity — the same entity.
  3. Nearest neighbour below review_similarity — a new entity, CREATEd.
  4. Anything left is genuinely ambiguous: the model sees at most max_candidates neighbours and returns skip / create / merge.

Merging into an immutable type falls back to CREATE on every path.