Modules
Extracts structured data from text with source grounding. Maps extraction strings back to exact byte positions in source text.
Maps extraction strings to byte spans in source text.
A token with its byte position in the source text.
Regex-based tokenizer that splits text into tokens with byte offsets.
A failed chunk with its byte position in the source and error reason.
A successfully processed chunk: its byte range in the source and the spans extracted from it.
Splits text into sentence-level chunks using the Alignment.Tokenizer.
A chunk of text with its byte offset in the source.
A configured LLM client for extraction.
A single extraction: an entity class, its verbatim source text, and arbitrary attributes.
Wires the full extraction pipeline.
Extraction pipeline: normalize LLM output, parse extractions, align to source text.
Parses canonical extraction maps into %Extraction{} structs.
Renders Q&A-formatted prompts from a template for LLM extraction.
Validates that few-shot examples in a LangExtract.Template are self-consistent.
Describes a single alignment problem in a few-shot example.
Raised by LangExtract.Prompt.Validator.validate!/1 when alignment issues are found.
Behaviour for LLM inference providers.
Claude (Anthropic) provider for LLM inference.
Gemini (Google) provider for LLM inference.
OpenAI provider for LLM inference.
A provider's successful inference response: the raw text plus token usage when the API reported it.
A completed extraction run: document-ordered spans plus per-chunk errors.
A caller-owned, supervised extraction runner with a shared request budget.
Bounded delivery of supervised chunk results to a lazy caller-side stream.
The runner's shared request budget: an RPM token bucket plus an in-flight
cap, with global backoff on retry-after.
A single chunk request through the runner's budget, with the runner's retry policy.
Serialization and deserialization of extraction results.
An aligned extraction with its byte position in the source text.
The extraction task definition: a plain-language description of what to extract, plus few-shot examples showing the expected output.
A single few-shot example: a sample text paired with the extractions
expected from it.
Port between external LLM format and internal domain.