LangExtract is a Python library from Google, with 38,000+ stars on GitHub, that extracts structured information from unstructured text using LLMs — with every result grounded to its exact place in the source.
Asking an LLM to “pull the medications out of this note” is easy; trusting the output is the hard part. LangExtract is built for verification: you define the extraction schema with a few examples, and the library maps every extracted entity back to its precise character location in the source text, so results can be highlighted, audited and corrected. Controlled generation on supported models keeps outputs in a consistent schema, and a chunking-plus-parallel-passes strategy handles long documents where key facts hide deep inside — clinical notes, reports, contracts and literature. It generates a self-contained interactive HTML visualization for reviewing extractions in context. Gemini is the native backend, but OpenAI models, custom providers and local models through Ollama are also supported. Google showcases it on medical use cases such as medication extraction and the RadExtract radiology demo. The project is actively developed, with updates through October 2026.
LangExtract is free and open source under the Apache License 2.0. If you use cloud models such as Gemini or OpenAI you pay that provider’s normal API rates; with local Ollama models it costs nothing to run.
Developers and data teams turning documents into structured data — in healthcare, legal, finance and research — who need extraction results they can trace and defend, not just plausible JSON.