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:
- settings –
Parameters:
- settings (
ExtractionLLMSettings | None) – LLM client config. Defaults toExtractionLLMSettings(), loaded from the environment/.env. Ignored whenclientis given: an injected client also disablessettings.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 exposingExtractEntitiesAndRelations. Tests inject a fake here. - tracer (
Tracer | None) – Opensagrag.extraction.bamland the nestedagrag.llm.callspans.Noneopens no recorded span. - include_heading_path (
bool) – Whether to give the model the heading path of the chunk as a separatesectionline above the text. Offsets still indexchunk.text. Only this extractor uses heading context.
extract
extract(chunk:Chunk, schema:GraphSchema) -> ExtractionResult
Extract with an LLM call through the configured ClientRegistry.
Raises:
ExtractorMissingExtraError– Thellmpackage extra is not installed.ValueError–chunk.idisNone.
settings
settings = settings