Skip to main content
Version: 0.0.5 (stable)

agrag.ingestion.reports.escalation_report.EscalationReport

Bases: BaseModel

How many chunks the LLM extractor read, and how many it left alone.

The first extractor reads every chunk. A chunk is eligible for the LLM extractor when that first result is weak. The escalation budget then caps how many eligible chunks the LLM extractor reads, weakest first. All counts cover the chunks of one run. A run with several batches merges the batch reports.

Attributes:

  • mode (Literal['gliner', 'hybrid', 'llm']) – The effective extraction mode of the run. A run with no LLM extractor reports gliner.
  • total (int) – The chunks that the run extracted from.
  • skipped_short (int) – In llm mode, the chunks under min_escalation_words words that were not sent to the LLM extractor. Zero in other modes.
  • eligible (int) – The chunks whose first result was weak enough to escalate. Zero in llm mode, which has no first result to judge.
  • escalated (int) – The chunks that the LLM extractor was called on. In llm mode these are the chunks that were not skipped short.
  • left_for_gliner (int) – The eligible chunks that kept the first result because the budget ran out.
  • lowest_score_left (float | None) – The lowest span score among the chunks counted in left_for_gliner, or None when no such chunk has a score.
  • failed (int) – The escalated chunks that kept the first result because the LLM call raised, its answer did not parse, or it parsed to no entities while the first result had some. Counted inside escalated.
  • budget_needed (float) – The smallest escalation_budget that escalates every eligible chunk, as a share of the chunks in a batch. For a run of several batches it is the largest need of any one batch, because the budget applies to each batch on its own.
  • primary_seconds (float) – Wall-clock seconds the first extractor spent on all chunks, summed over batches.
  • escalation_seconds (float) – Wall-clock seconds the LLM extractor spent, summed over batches.

Functions:

  • merge – Combine the reports of several batches into one.

budget_needed​

budget_needed: float = Field(default=0.0, ge=0.0)

eligible​

eligible: int = Field(default=0, ge=0)

escalated​

escalated: int = Field(default=0, ge=0)

escalation_seconds​

escalation_seconds: float = Field(default=0.0, ge=0.0)

failed​

failed: int = Field(default=0, ge=0)

left_for_gliner​

left_for_gliner: int = Field(default=0, ge=0)

lowest_score_left​

lowest_score_left: float | None = None

merge​

merge(reports:Iterable[EscalationReport]) -> EscalationReport

Combine the reports of several batches into one.

Parameters:

  • reports (Iterable[EscalationReport]) – One report per batch.

Returns:

  • EscalationReport – The mode of the batches (one run has one mode), the summed counts
  • EscalationReport – and seconds, the lowest lowest_score_left of any batch, and the
  • EscalationReport – largest budget_needed of any batch. No reports give the empty
  • EscalationReport – report.

mode​

mode: Literal['gliner', 'hybrid', 'llm'] = 'gliner'

primary_seconds​

primary_seconds: float = Field(default=0.0, ge=0.0)

skipped_short​

skipped_short: int = Field(default=0, ge=0)

total​

total: int = Field(default=0, ge=0)