Skip to main content
Version: 0.0.4

agrag.ingestion.resolve.candidate_source.persisted_candidate_indices

persisted_candidate_indices(mentions:list[ExtractedEntity], entities:list[Entity], *, source:GraphCandidateSource, fallback_limit:int = 128) -> tuple[dict[int, list[int]], dict[tuple[int, int], float]]

Return ANN candidate indices, with a bounded exhaustive fallback.

The fallback only applies when no indexed candidates are available. It keeps first-time and small-graph consolidation deterministic without returning to an unbounded pairwise scan for established graphs.

Returns:

  • dict[int, list[int]] – Mention index to its candidate entity indices, plus each compared
  • dict[tuple[int, int], float] – pair's real embedding cosine similarity keyed by (min, max)
  • tuple[dict[int, list[int]], dict[tuple[int, int], float]] – index order (matching how Resolver.resolve builds its own pair
  • tuple[dict[int, list[int]], dict[tuple[int, int], float]] – keys). The exhaustive-fallback branch reports no scores, so its
  • tuple[dict[int, list[int]], dict[tuple[int, int], float]] – similarity map is empty.