Skip to content
Sign in
  • Browse all toolsFilter by category and pricing
  • Browse categoriesWriting, code, image, audio and more
  • Compare toolsPut up to three side by side
  • Read the blogGuides and comparisons

LangExtract

Python library for LLM-based structured text extraction with source grounding and interactive HTML visualization.

LangExtract is an open-source Python library that extracts structured information from unstructured text using LLMs, user instructions and examples. LangExtract provides source grounding and interactive visualizations for developers and researchers processing documents. LangExtract is available under the Apache-2.0 license through PyPI or GitHub; cloud models require API keys.

Updated 9 Nov 20266 sections

At a glance

Pricing
FreeLangExtract is an open-source project under the Apache-2.0 license. Cloud models require API keys; a paid Gemini tier is suggested for production or large-scale use.
Added
9 Nov 2026
LangExtract website screenshot

What is LangExtract?

LangExtract is an open-source Python library for turning unstructured text into structured information with large language models. LangExtract follows user-defined extraction instructions and examples, then links extracted details to locations in the source document. The library supports document-processing work involving clinical notes, reports and literary texts, with an emphasis on traceability and review.

LangExtract is hosted in Google's GitHub repository and distributed through PyPI under the Apache-2.0 license. LangExtract supports cloud-hosted models and local models rather than requiring a single provider. A browser-based live demo lets users explore grounded extraction on Romeo and Juliet without installing the library.

What LangExtract can do

LangExtract combines structured extraction with tools for checking where results came from. Prompts and examples define the desired entities, attributes and output structure, while supported models can enforce output constraints. For longer documents, LangExtract offers chunking, parallel processing and repeated extraction passes to improve recall, followed by visual review of the resulting entities.

  • LangExtract maps located extractions to exact positions in source text.
  • LangExtract supports schema-constrained output with supported models.
  • LangExtract processes long documents using chunking and parallel execution.
  • LangExtract saves annotated extraction results as JSONL.
  • LangExtract generates self-contained interactive HTML visualizations.
  • LangExtract supports Vertex AI batch processing for large-scale tasks.

How LangExtract works

LangExtract starts with a prompt describing the extraction task and examples showing the expected results. Example extractions should use verbatim source wording and follow the order of appearance. Users pass the input text, instructions, examples and model selection to the extraction function. LangExtract raises alignment warnings when examples do not follow the expected pattern.

LangExtract can be installed from PyPI, installed from source or run with Docker. Cloud model access uses API keys configured through environment variables, an environment file or code. Local model use is available through Ollama without an API key. After extraction, users can save results and generate an HTML file for reviewing entities in their original context.

Who LangExtract is for

LangExtract suits Python developers and researchers who need structured outputs from text and a way to inspect supporting evidence. The examples cover clinical materials and literary analysis, while user-defined instructions allow extraction tasks in other domains. LangExtract does not require model fine-tuning to adapt extraction behavior, but task definitions and example quality remain important.

  • LangExtract can organize key details from clinical notes and reports.
  • LangExtract can extract characters, emotions and relationships from literary text.
  • LangExtract can process full documents supplied through URLs.
  • LangExtract can help reviewers inspect extracted entities against source passages.

LangExtract pricing and access

LangExtract is available as an open-source project under the Apache-2.0 license, with installation instructions for PyPI and the source repository. The page does not list a separate library subscription or usage price. Model access is a separate consideration: cloud-hosted models require API keys, and the documentation recommends a paid Gemini tier for production or large-scale workloads to increase throughput and avoid rate limits.

LangExtract strengths and limitations

LangExtract provides source-linked extraction, configurable model choices and interactive result inspection in a Python workflow. These capabilities help users review structured data rather than relying only on model-generated output. However, grounding does not eliminate every extraction issue: LangExtract explicitly identifies results that cannot be located in the input, and the documentation describes filtering those results when only grounded extractions are wanted.

  • LangExtract requires Python setup and code for the documented library workflow.
  • LangExtract accuracy depends on the model, task complexity, instructions and examples.
  • LangExtract cloud workflows require API keys and must account for provider rate limits.
  • LangExtract may return ungrounded extractions that need filtering.

LangExtract FAQ

What is LangExtract?

LangExtract is an open-source Python library that uses LLMs to extract structured information from unstructured text. LangExtract follows user-defined instructions and examples, links extracted information to source locations, and generates interactive HTML visualizations for reviewing results.

Is LangExtract free?

LangExtract is available as an open-source project under the Apache-2.0 license. The repository does not list a library subscription price. Cloud-hosted models require API keys, and the documentation suggests a paid Gemini tier for production or large-scale workloads; local models through Ollama do not require API keys.

Which models does LangExtract support?

LangExtract supports Google Gemini, OpenAI models and local models through a built-in Ollama interface. LangExtract also supports custom model providers and documents Vertex AI batch processing. Cloud-hosted model use requires an API key, while on-device models do not.

How does LangExtract ground extracted information in the source?

LangExtract maps located extractions to their exact positions in the source text for highlighting and verification. LangExtract marks extractions that cannot be found in the input with a missing character interval, allowing users to filter those results when only source-grounded information is needed.

Can LangExtract process long documents?

LangExtract supports long-document extraction through text chunking, parallel processing and multiple extraction passes. LangExtract can process documents directly from URLs and save results as JSONL, then generate an interactive HTML visualization for reviewing extracted entities in their original context.

How do you install LangExtract?

LangExtract can be installed from PyPI with pip or from its GitHub source repository. LangExtract also includes Docker instructions. After installation, users define an extraction prompt and examples, select a model, and configure an API key if using a cloud-hosted model.

From the community

No reviews yet

Be the first to review this tool. What you write helps the next person choose.

More tools like LangExtract

Ollama-OCR

www.github.com

Extract text and tables from images and PDFs using Ollama vision models through Python or a Streamlit web app.

Free

Landing AI

www.landing.ai

AI document extraction with structured outputs, source citations, and APIs for document workflows.

Freemium

LlamaIndex

www.github.com

Open-source framework for building RAG and agent applications with private data.

Free

Firecrawl

www.github.com

An open-source API for web search, scraping, browser interaction, and structured data extraction for AI agents.

Free