Skip to main content
Version: latest

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, entity_labels:Sequence[str], tracer:Tracer | None, max_llm_pairs:int, error_policy:ErrorPolicy, schema:GraphSchema | None = None, vector_store:VectorStore | None = None, job_id:UUID | str | None = None, llm_concurrency:int = DEFAULT_LLM_CONCURRENCY, on_progress:Callable[[int, int, float], None] | None = None, llm_enabled:bool = True) -> 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) – External dense candidate index. None uses graph indexes.
  • entity_labels (Sequence[str]) – The labels the schema defines.
  • schema (GraphSchema | None) – Declared entity types. Each LLM request describes the types present in its pairs, with their descriptions.
  • 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.
  • llm_concurrency (int) – Maximum simultaneous verification requests.
  • on_progress (Callable\[[int, int, float], None] | None) – Receives completed batches, total batches and elapsed seconds.
  • error_policy (ErrorPolicy) – RAISE propagates candidate-read failures. Other policies record candidate-read failures and leave those mentions unresolved. Telemetry reads never change the result.
  • job_id (UUID | str | None) – The in-flight Cutover Job's id for the exact-match read.
  • llm_enabled (bool) – Whether ambiguous pairs may be sent to a server-side LLM. False leaves them undecided without reading LLM settings.

Returns:

Raises:

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