Skip to main content
Version: 0.0.4

agrag.ingestion.extract.EscalatingExtractor

EscalatingExtractor(primary:Extractor, escalate_to:Extractor, *, min_confidence:float = 0.5, min_chunk_words:int = 8, tracer:Tracer | None = None) -> None

Bases: Extractor

Runs a cheap primary extractor first, escalating per chunk when it's weak.

Functions:

  • extract – Extract with the primary extractor, escalating when it's weak.

Attributes:

Parameters:

  • primary (Extractor) – Runs first, for every chunk.
  • escalate_to (Extractor) – Runs instead of, never in addition to, the primary's result, when escalation triggers. Merging both extractors' output would mean reconciling overlapping spans between them, which is what entity resolution is for, not extraction.
  • min_confidence (float) – Escalate when the primary's mean entity confidence falls below this, among entities that report a confidence.
  • min_chunk_words (int) – Below this word count, a zero-entity result from the primary is treated as plausibly correct, not a miss.
  • tracer (Tracer | None) – Opens the agrag.extraction.escalating span. None opens no recorded span.

escalate_to​

escalate_to = escalate_to

extract​

extract(chunk:Chunk, schema:GraphSchema) -> ExtractionResult

Extract with the primary extractor, escalating when it's weak.

Returns escalate_to's result outright when escalation triggers, never a combination of both extractors' results.

min_chunk_words​

min_chunk_words = min_chunk_words

min_confidence​

min_confidence = min_confidence

primary​

primary = primary