API Reference LangExtract v#0.6.0

Copy Markdown View Source

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.

An aligned extraction with its byte position in the source text.

A token with its byte position in the source text.

Regex-based tokenizer that splits text into tokens with byte offsets.

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.

A failed chunk with its byte position in the source and error reason.

Parses canonical extraction maps into %Extraction{} structs.

Renders Q&A-formatted prompts from a template for LLM extraction.

A single few-shot example: a sample text paired with the extractions expected from it.

The extraction task definition: a plain-language description of what to extract, plus few-shot examples showing the expected output.

Validates that few-shot examples in a LangExtract.Prompt.Template are self-consistent.

Describes a single alignment problem in a few-shot example.

Behaviour for LLM inference providers.

Claude (Anthropic) provider for LLM inference.

Gemini (Google) provider for LLM inference.

OpenAI provider for LLM inference.

Serialization and deserialization of extraction results.

Port between external LLM format and internal domain.