Version: latest
agrag.ingestion.settings.ExtractionSettings
Bases: BaseSettings
Configuration for local entity and relation extraction.
Every score is between 0 and 1. ExtractionLLMSettings variables start
with EXTRACTION_LLM_ and are not read here, so no field may start with
llm_.
The entity and relation thresholds, the relation floor, the entity band and
the candidate switch shape what GlinerExtractor keeps and reports.
The escalation threshold, budget and minimum word count decide which weak
chunks go to the LLM extractor in hybrid mode.
Attributes:
- mode (
Literal['gliner', 'hybrid', 'llm']) – Extractor mode.glinerruns GLiNER only;hybridruns GLiNER and may escalate weak chunks to the LLM;llmruns the LLM on every chunk. Escalation settings apply only tohybrid. This mode does not control entity resolution. Resolution has its own optional LLM tier, which runs whenever LLM settings exist, even inglinermode. - model_name (
str) – GLiNER checkpoint. - dtype (
Literal['fp32', 'fp16', 'bf16']) – Model precision:fp32,fp16orbf16. - entity_threshold (
_Score) – Minimum score for a kept entity span. - relation_threshold (
_Score) – Minimum score for a kept relation. - relation_floor (
_Score) – Minimum relation score returned by the model. - band_floor (
_Score) – Minimum entity score in the band below the keep threshold. - label_thresholds (
dict[str, _Score]) – Per-label thresholds keyed by entity or relation label. An entity label's threshold replacesentity_thresholdfor that label. A relation label's threshold replacesrelation_thresholdas the cut for kept relations, and the model reads that relation at the lower of the threshold andrelation_floor. - escalation_threshold (
_Score) – Entity score below which a chunk may use the LLM. - escalation_budget (
_Score | Literal['all']) – LLM chunk share from 0 to 1, or"all"for no limit. - min_escalation_words (
int) – Minimum words for a chunk with no entities to use the LLM. - candidates_enabled (
bool) – Whether discarded items are kept as candidates.
Env prefix: EXTRACTION_. label_thresholds uses one JSON object,
such as EXTRACTION_LABEL_THRESHOLDS='{"Person": 0.7}'.
band_floor
band_floor: _Score = 0.3
candidates_enabled
candidates_enabled: bool = True
dtype
dtype: Literal['fp32', 'fp16', 'bf16'] = 'fp32'
entity_threshold
entity_threshold: _Score = 0.5
escalation_budget
escalation_budget: _Score | Literal['all'] = 0.2
escalation_threshold
escalation_threshold: _Score = 0.75
label_thresholds
label_thresholds: dict[str, _Score] = Field(default_factory=dict)
min_escalation_words
min_escalation_words: int = Field(default=8, ge=0)
mode
mode: Literal['gliner', 'hybrid', 'llm'] = 'hybrid'
model_config
model_config = SettingsConfigDict(env_prefix='EXTRACTION_', env_file='.env', extra='ignore', hide_input_in_errors=True, protected_namespaces=())
model_name
model_name: str = 'fastino/gliner2.5-base-v1'
relation_floor
relation_floor: _Score = 0.3
relation_threshold
relation_threshold: _Score = 0.7