#44th of 6 in Data and scraping for AI

langextract

Python library that extracts source-grounded structured data from text using LLMs

Stars
38.9k
License
Apache-2.0
Last commit
Oct 2026
Last release
Oct 2026
Language
Python
Stars, last 29 weeks+4,519
24 Mar 2026: 34,426 stars31 Mar 2026: 34,561 stars7 Apr 2026: 35,074 stars14 Apr 2026: 35,213 stars21 Apr 2026: 35,322 stars28 Apr 2026: 35,762 stars5 May 2026: 36,016 stars12 May 2026: 36,099 stars19 May 2026: 36,166 stars26 May 2026: 36,254 stars2 Jun 2026: 36,500 stars9 Jun 2026: 36,573 stars16 Jun 2026: 36,640 stars23 Jun 2026: 36,692 stars30 Jun 2026: 36,739 stars7 Jul 2026: 36,872 stars14 Jul 2026: 36,953 stars21 Jul 2026: 37,477 stars28 Jul 2026: 37,754 stars4 Aug 2026: 37,827 stars11 Aug 2026: 38,158 stars18 Aug 2026: 38,307 stars25 Aug 2026: 38,376 stars1 Sept 2026: 38,423 stars8 Sept 2026: 38,471 stars15 Sept 2026: 38,516 stars22 Sept 2026: 38,590 stars29 Sept 2026: 38,873 stars6 Oct 2026: 38,902 stars13 Oct 2026: 38,945 stars

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
Also in Data and scraping for AI
RankProjectScore
1Crawl4AIPython web crawler that converts pages to LLM-ready Markdown and JSON85.5k starsApache-2.074 out of 100
2doclingPython library and CLI that converts PDFs, Office files and more into structured text68.8k starsMIT72 out of 100
3FirecrawlWeb scraping and crawling API that returns LLM-ready markdown Live demo ↗ (opens in a new tab)191.3k starsAGPL-3.067 out of 100
#5paddleocrOCR and document parsing toolkit that outputs Markdown and JSON from PDFs and images Live demo ↗ (opens in a new tab)91.1k starsApache-2.055 out of 100
#6Jina ReaderConverts any URL or search query into LLM-friendly markdown Live demo ↗ (opens in a new tab)12.1k starsApache-2.045 out of 100