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 reportsgliner. - total (
int) – The chunks that the run extracted from. - skipped_short (
int) – Inllmmode, the chunks undermin_escalation_wordswords 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 inllmmode, which has no first result to judge. - escalated (
int) – The chunks that the LLM extractor was called on. Inllmmode 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 inleft_for_gliner, orNonewhen 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 insideescalated. - budget_needed (
float) – The smallestescalation_budgetthat 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 countsEscalationReport– and seconds, the lowestlowest_score_leftof any batch, and theEscalationReport– largestbudget_neededof any batch. No reports give the emptyEscalationReport– 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)