LangExtract

LangExtract

★ 4.4 🔖 7000 saves 💰 Free GitHub

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.

Overview

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.

Key Features

  • Precise source grounding – every extraction points to its exact location in the source text.
  • Schema-based output – few-shot examples define a consistent, structured result format.
  • Long-document strategy – chunking, parallel processing and multiple passes raise recall on big files.
  • Interactive visualization – review extractions in a self-contained HTML file with source highlighting.
  • Multiple backends – Gemini natively, plus OpenAI models, custom providers and local Ollama models.
  • Real-world demos – medication extraction and radiology report structuring examples included.
  • Python-native – install from PyPI and integrate into data pipelines in a few lines.

💳 Pricing

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.

Who Is It For

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.

🚀 Visit LangExtract Official Site

🚩 Report an issue