LangExtract is a Python library for developers who need to extract structured data from unstructured text documents while maintaining exact source traceability. It supports optional cloud LLMs and local LLMs via Ollama, enabling domain-specific extraction with few-shot examples.
Project overview
Provides source grounding for every extraction and generates interactive HTML visualizations for entity review.
Project type
RAG · Document Processing · Prompt Engineering
Use cases
Knowledge Q&A
Deployment
Refer to project documentation
License
Apache-2.0
Best for
Developers needing structured data extraction from unstructured text documents with visual highlighting for traceability.
Teams requiring long-document optimization with text chunking and parallel processing for higher recall.
Key capabilities
Maps every extraction to its exact location in the source text, enabling visual highlighting for traceability.
Processes large documents using text chunking, parallel processing, and multiple extraction passes for higher recall.
Generates a self-contained, interactive HTML file to visualize and review extracted entities in their original context.
Supports adding custom LLM providers via a lightweight plugin system independently of the core library.
Enables Vertex AI Batch API for saving costs on large-scale tasks.
Limitations and risks
Ollama does not currently support output_schema, which may affect structured output formatting when using local models.
Getting started
Install the package from PyPI using pip, configure your API key as an environment variable, and run extraction using the lx.extract() method in your Python code. Coding is required to use this library.
Evidence and sources
GitHub project description: A Python library for extracting structured information from unstructured text using LLMs with precise source grounding and interactive visualization.
README: LangExtract is a Python library that uses LLMs to extract structured information from unstructured text documents based on user-defined instructions. It processes materials such a…
README: 1. **Precise Source Grounding:** Maps every extraction to its exact location in the source text, enabling visual highlighting for easy traceability and verification. 2. **Reliable…
README: LangExtract supports custom LLM providers via a lightweight plugin system. You can add support for new models without changing core code. - Add new model support independently of…