Skip to main content
Version: 0.0.4

agrag.ingestion.extract.BAMLExtractor

BAMLExtractor(*, settings:ExtractionLLMSettings | None = None, client:object | None = None, tracer:Tracer | None = None, include_heading_path:bool = True) -> None

Bases: Extractor

Extracts with an LLM, via a BAML function and a runtime ClientRegistry.

Functions:

  • extract – Extract with an LLM call through the configured ClientRegistry.

Attributes:

Parameters:

  • settings (ExtractionLLMSettings | None) – LLM client config. Defaults to ExtractionLLMSettings(), loaded from the environment/.env. Ignored when client is given: an injected client also disables settings.retry, since a caller building its own client is assumed to own its own retry behavior too.
  • client (object | None) – An already-built BAML client object exposing ExtractEntitiesAndRelations. Tests inject a fake here.
  • tracer (Tracer | None) – Opens agrag.extraction.baml and the nested agrag.llm.call spans. None opens no recorded span.
  • include_heading_path (bool) – Whether to give the model the heading path of the chunk as a separate section line above the text. Offsets still index chunk.text. Only this extractor uses heading context.

extract​

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

Extract with an LLM call through the configured ClientRegistry.

Raises:

settings​

settings = settings