Skip to main content

agrag.ingestion.extract.GlinerExtractor

GlinerExtractor(*, model_name:str = 'fastino/gliner2.5-small-v1', model:object | None = None, tracer:Tracer | None = None) -> None

Bases: Extractor

Extracts entities and relations with a local GLiNER2.5 model.

The model runs in this process, so extraction needs no LLM key. It loads on first use and one load serves concurrent calls. The first load downloads the weights from Hugging Face unless model is passed. GLiNER reports entity spans and types, so extracted entities carry no property values. Needs the extract extra.

Parameters:

  • model_name (str) – Checkpoint to load when model is not provided.
  • model (object | None) – An already-built GLiNER2.5 model.
  • tracer (Tracer | None) – Opens agrag.extraction.gliner and agrag.extraction.model_load spans. None opens no recorded span.

Functions:

  • extract – Extract with the local GLiNER2.5 model.

Attributes:

extract​

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

Extract with the local GLiNER2.5 model.

Parameters:

  • chunk (Chunk) – The chunk to read. Only chunk.text and chunk.id are used.
  • schema (GraphSchema) – The entity and relation types to extract.

Returns:

  • ExtractionResult – The normalized entities and relations found in the chunk.

Raises:

model_name​

model_name = model_name