LangExtract

Python library for LLM-based structured extraction that grounds every result in exact source offsets.

Open SourceSelf HostedOffline Capable
0.0 (0)

About

Google released LangExtract to make LLM information extraction verifiable: every extracted entity is mapped to exact character offsets in the source text, so results can be highlighted and audited instead of trusted blindly. Developers define an extraction task with a prompt and a handful of few-shot examples rather than fine-tuning, and the library enforces reliable structured output through schema constraints on supported models. Long documents are handled with chunking, parallel processing, and optional multi-pass extraction for better recall, and results render to an interactive HTML visualization for review. Gemini is the primary backend, with OpenAI models, Vertex AI batch processing, and fully local inference through Ollama also supported via a custom provider plugin system. Installation is pip install langextract; the project is Apache-2.0 licensed, sits at version 1.6.0, and has accumulated about 37,900 stars since its 2025 release. Teams use it to pull structured records from clinical notes, legal documents, and long reports at auditable quality.

Should you use LangExtract?

Pick it when

Pick LangExtract when you must pull structured records from long documents such as clinical notes, contracts, or reports, and reviewers need to see the exact source span behind every value, defined with a prompt and a few examples.

Look elsewhere when

Skip it if per-document LLM cost or latency is a problem at your volume; GLiNER finds entity spans on CPU. It is Gemini-first, so fully local use means setting up Ollama and accepting the quality of the model you run.

Alternatives to LangExtract

  • GLiNER

    Small zero-shot NER model on CPU with no API costs, fine for typed spans and relations, but it does not produce full schema-shaped records.

  • Instructor

    Pydantic-typed structured output from many LLM providers with less setup, but no source offsets, long-document chunking, or review visualization.

  • Outlines

    Constrained decoding guarantees valid structured output from local models, but you build chunking and source grounding yourself.

  • spaCy

    Trained, deterministic extraction pipelines that run fast on CPU at scale, but need annotated data for every new field you want.

Reviews (0)

Leave a Review

No reviews yet. Be the first to review!

Details

Price
Free
Platform
Local/Desktop
Difficulty
Easy (2/5)
License
Apache-2.0
Added
Jul 29, 2026

Tags