Extract structured information from unstructured text using LLMs, with precise source grounding
open sourceApache-2.0self-hostablefree
LangExtract is Google's open source Python library for extracting structured information from unstructured text with LLMs, from instructions and a few examples and without fine-tuning. Every extraction is mapped to its exact location in the source text, outputs follow a consistent schema (using controlled generation on models such as Gemini), and long documents are handled with chunking, parallel processing and multiple passes for higher recall. It generates a self-contained interactive HTML file to review extracted entities in context, and works with Gemini, OpenAI models, local models through Ollama and community provider plugins. Examples include medication extraction from clinical notes and structuring radiology reports.
Problems it solves
- extract structured entities from long documents with an LLM
- show exactly where in the source text each extracted value came from
- pull medications and dosages out of clinical notes
- turn free-text reports into structured records without fine-tuning a model
- review thousands of LLM extractions visually in context
- run information extraction on a local model through Ollama
Features
- few-shot extraction tasks defined by instructions and examples
- source grounding to exact text spans
- consistent schema with controlled generation
- chunking, parallel processing and multiple passes for long documents
- interactive HTML visualization
- Gemini, OpenAI and Ollama models
- custom and community provider plugins
Limitations
- Not an officially supported Google product1
Capabilities
| Takes plugins | plan not known |
|---|---|
| Has official SDKs | plan not known |
