Skip to main content

agrag.ingestion.resolve.resolution.resolve_batch

resolve_batch(mentions:list[ExtractedEntity], relations:Sequence[ExtractedRelation], chunks_by_id:dict[UUID, Chunk], *, graph_store:GraphStore, embedder:Embedder, vector_store:VectorStore | None, vector_collection:str, entity_labels:Sequence[str], tracer:Tracer | None, max_llm_pairs:int, error_policy:ErrorPolicy, job_id:UUID | str | None = None) -> BatchResolution

Resolve one extraction batch against itself and the persisted graph.

The resolver sees the real mentions plus one synthetic mention per persisted ANN candidate, so a new mention can join a persisted cluster through one pass. Synthetic mentions never initiate a comparison.

Parameters:

  • mentions (list[ExtractedEntity]) – The batch's extracted mentions.
  • relations (Sequence[ExtractedRelation]) – The relations addressing mentions, used as neighbor context.
  • chunks_by_id (dict[UUID, Chunk]) – The batch's chunks, for LLM verification context.
  • graph_store (GraphStore) – Where exact-match, candidate, and neighbor reads run.
  • embedder (Embedder) – Embeds mention text for candidate search and fuzzy review.
  • vector_store (VectorStore | None) – Optional vector store the candidate search reads.
  • vector_collection (str) – Collection name for the candidate search.
  • entity_labels (Sequence[str]) – The labels the schema defines.
  • tracer (Tracer | None) – Opens the phase spans and traces the resolver.
  • max_llm_pairs (int) – The most ambiguous pairs per label sent to the LLM.
  • error_policy (ErrorPolicy) – RAISE propagates a failed candidate read; any other policy records it and leaves that mention unresolved.
  • job_id (UUID | str | None) – The in-flight Cutover Job's id for the exact-match read.

Returns:

  • BatchResolution – The exact matches, exact groups, resolver result, persisted
  • BatchResolution – candidates, and candidate-read failures for the batch.

Raises:

  • Exception – A candidate read failed and error_policy is RAISE.