#44th of 6 in Data and scraping for AI
langextract
Python library that extracts source-grounded structured data from text using LLMs
Live demo ↗
(opens in a new tab)Documentation ↗
(opens in a new tab)Repository on GitHub ↗
(opens in a new tab)
- Stars
- 38.9k
- License
- Apache-2.0
- Last commit
- Oct 2026
- Last release
- Oct 2026
- Language
- Python
34,426 on 24 Mar 202638,945 on 13 Oct 2026
From GitHub's daily star counts.
Checked on GitHub.
Overview
LangExtract is a Python library that takes a prompt and few-shot examples, runs an LLM over unstructured text, and returns structured extractions mapped to exact character spans in the source. Long documents are handled by chunking, parallel workers and multiple passes. Results save to JSONL and render as an interactive HTML review page. Backends include Gemini, OpenAI and local Ollama models.
Who it is for: Python developers extracting structured data from long documents
Strengths
- Each extraction is grounded to a character span; ungrounded results get char_interval = None
- Chunking, parallel workers and multiple passes for long documents (max_workers, extraction_passes)
- Gemini, OpenAI and Ollama supported, plus a plugin system for custom providers
- Generates a self-contained interactive HTML view of extractions in context
Weaknesses
- Output schema is driven by few-shot examples; poor examples cause alignment warnings and weaker results
- Ollama provider does not support output_schema
- Controlled generation is documented mainly for Gemini; cloud models need an API key
- Library only, with no server or UI beyond the HTML visualization
What it needs
- GPU optional
- Docker
- Needs Gemini, OpenAI or Vertex AI API key for cloud models, Ollama for local models
- Models: Gemini, OpenAI, Ollama, Vertex AI, OpenAI-compatible endpoints
Head to head
Also in Data and scraping for AI
See all 6| Rank | Project | Score |
|---|---|---|
| 1 | Crawl4AIPython web crawler that converts pages to LLM-ready Markdown and JSON | 74 out of 100 |
| 2 | doclingPython library and CLI that converts PDFs, Office files and more into structured text | 72 out of 100 |
| 3 | FirecrawlWeb scraping and crawling API that returns LLM-ready markdown | 67 out of 100 |
| #5 | paddleocrOCR and document parsing toolkit that outputs Markdown and JSON from PDFs and images | 55 out of 100 |
| #6 | Jina ReaderConverts any URL or search query into LLM-friendly markdown | 45 out of 100 |