Build
Connect & operate
Design & teams
Start hereScope a build in one callBring a spec, a wireframe, or a paragraph. You leave with an architecture, a timeline, and a number.Book a scoping call
AI software
LLM & data systems
Vibe coding
Ready to ship?Put AI where the work isAgents, RAG, and private LLMs wired into the systems your team already uses — not a chatbot bolted to a homepage.Discuss an AI project
Domain firstWe learn your workflow before we model itRegulated, operational, or high-volume — the constraints belong in the schema, not in a training doc.Talk about your domain
Plan smarterEstimate before you commitCost ranges, scope templates, and the questions we ask in discovery — free, no form.Open the cost calculator
Real conversationsTalk with a technical leadNo SDR, no discovery gauntlet. The person on the call is the one who scopes the build.Book a call
AI Frameworks · google

langextract

LangExtract is a Google-authored Python library that extracts structured information from unstructured documents using LLMs, with precise source grounding (character-level mapping) and interactive HTML visualization. It supports Gemini, OpenAI, and local models via Ollama, handling long documents through intelligent chunking and multi-pass processing.

Source: GitHub — github.com/google/langextract
37.1k
GitHub stars
2.6k
Forks
Python
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorygoogle/langextract
Ownergoogle
Primary languagePython
LicenseApache-2.0 — OSI-approved
Stars37.1k
Forks2.6k
Open issues106
Latest releasev1.6.0 (2026-07-02)
Last updated2026-07-02
Sourcehttps://github.com/google/langextract

What langextract is

LangExtract provides schema-enforced extraction via few-shot prompting and controlled generation (Gemini/OpenAI). It maps extractions to source character intervals for grounding verification, processes documents in parallel chunks with configurable passes, and outputs JSONL-serializable results with optional HTML visualization. Built for NLP/information extraction workflows with LLM flexibility.

Quickstart

Get the langextract source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/google/langextract.gitcd langextract# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Clinical/Medical Document Structuring

Extract medications, diagnoses, and findings from radiology reports and clinical notes with source-grounded verification, reducing manual review overhead in regulated environments.

Long-Form Document Analysis at Scale

Process hundreds of pages (e.g., legal contracts, research papers, policy documents) with parallel multi-pass extraction to surface nested or distributed entities reliably.

Domain-Specific Few-Shot Extraction without Fine-Tuning

Adapt extraction tasks (insurance claims, incident reports, scientific abstracts) by providing examples and prompts, avoiding costly model retraining while leveraging LLM world knowledge.

Implementation considerations

  • Extraction quality depends heavily on prompt clarity and example quality; invest time in few-shot design and validate on representative samples before scaling.
  • Source grounding (char_interval) fails for hallucinated content; filter results with `[e for e in result.extractions if e.char_interval]` to keep only verifiable extractions.
  • Long documents (>100K tokens) incur higher API costs and latency; tuning `extraction_passes`, chunk size, and model choice (Flash vs. Pro) impacts cost-quality trade-off.
  • Gemini models have defined retirement dates; monitor official model lifecycle documentation and plan migrations for production deployments.
  • Output schema constraints (enums, nested structures) are supported on Gemini and OpenAI; fallback behavior on other models requires testing.

When to avoid it — and what to weigh

  • Offline-Only Environments — Primary workflow requires cloud LLM APIs (Gemini, OpenAI) or external Ollama setup; not suitable for air-gapped or fully on-premise systems without additional infrastructure.
  • Sub-Millisecond Latency Requirements — LLM-based extraction inherently introduces network and model inference latency; inappropriate for real-time stream processing or microsecond-scale applications.
  • Highly Sensitive Data Without Strict Data Residency — Cloud-based LLMs (Gemini, OpenAI) process text on external servers; use local Ollama models if data cannot leave your infrastructure for compliance/privacy reasons.
  • Fully Deterministic or Rule-Based Extraction — LLM outputs introduce variability and occasional hallucinations; regex/rule engines are more predictable for rigid, unambiguous patterns.

License & commercial use

Apache License 2.0 (Apache-2.0). Permissive OSI-approved license allowing commercial use, modification, and distribution with attribution and indemnification clauses. Suitable for proprietary and open-source projects.

Apache-2.0 explicitly permits commercial use. However, commercial viability depends on external LLM API costs (Gemini, OpenAI) and data residency constraints. Requires paid API tiers for production volume. Ensure compliance review of your LLM provider's terms and data handling for your use case.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

Text sent to cloud LLMs (Gemini, OpenAI) is processed on external servers; review provider data retention and privacy policies before processing sensitive data (PII, health info, confidential docs). Local Ollama models avoid external data transfer. No claims made about model robustness against adversarial inputs. Validate grounded extractions in regulated domains (healthcare, legal) to prevent LLM hallucinations affecting downstream decisions.

Alternatives to consider

OpenAI Structured Outputs / GPT Function Calling

Direct schema-constrained generation without grounding; lower per-call cost but no source mapping; suitable if verification/audit trails not required.

Hugging Face Transformers (fine-tuned extraction models)

Fully on-premise, deterministic outputs; requires labeled training data and GPU; better for closed-domain tasks where data residency is non-negotiable.

Apache Tika / GATE / spaCy (rule/ML pipelines)

Lightweight, offline-first; no LLM dependency; limited adaptability to new domains; better for high-volume deterministic extraction (structured formats, known patterns).

Software development agency

Build on langextract with DEV.co software developers

Explore LangExtract on GitHub, try the quick-start guide with Gemini or Ollama, and visualize extractions in minutes. Review Apache-2.0 license terms for your use case.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

langextract FAQ

Does LangExtract require GPU or special hardware?
No for cloud model workflows (Gemini, OpenAI). Ollama for local models benefits from GPU but can run on CPU. Python environment is standard (no specialized accelerators required).
How much do Gemini API calls cost?
Unknown from provided data. Refer to official Google AI pricing. Production use is noted as requiring paid tiers; calculate based on document volume and extraction_passes setting.
Can I use LangExtract offline?
Partially. Cloud models (Gemini, OpenAI) require internet. Ollama enables local model inference. Visualization generation and JSONL I/O are offline-capable.
What happens if an extraction cannot be found in the source text?
LangExtract detects hallucinations automatically; ungrounded extractions have `char_interval = None`. Filter with `[e for e in result.extractions if e.char_interval]` to retain only source-verified results.

From evaluation to production software

Bringing langextract into production usually means new services, new interfaces, and new failure modes. DEV.co is a software development agency that builds all three and stays on for the ai frameworks maintenance.

Ready to Extract Structured Data from Your Documents?

Explore LangExtract on GitHub, try the quick-start guide with Gemini or Ollama, and visualize extractions in minutes. Review Apache-2.0 license terms for your use case.