LangExtract is a Python library for extracting structured information from unstructured text using large language models with precise source grounding and interactive visualization.
The library addresses the challenge of converting unstructured documents like clinical notes or reports into organized, structured data while maintaining verifiable connections to the source material. It works by chunking input text, processing it in parallel through an LLM based on user-defined extraction instructions, and then grounding every extracted value back to its exact character span in the original document. This approach ensures that extracted information can be traced and verified against the source.
Developers should choose this tool when they need reliable structured data extraction with accountability—particularly in domains like healthcare, legal review, or any context where tracing extracted values to their source is critical. The library supports multiple LLM providers including Google's Gemini models, OpenAI, and local models via Ollama, as well as custom model providers. It includes interactive visualization capabilities and has been applied to use cases ranging from medication extraction to radiology report structuring.
The project maintains a substantial base of real-world adopters, with almost all open issues raised by outside users rather than the core team. Maintainers typically respond to new issues and pull requests within a few days. Work in the issue tracker is dominated by discussions around alternative LLM providers and enhancement requests, reflecting active community engagement with the tool's extensibility and model support.