← All open source projects

LangExtract

google/langextract

LangExtract is a Google Python library for extracting structured data from unstructured text.

Forks 2,551
Author google
Language Python
License Apache-2.0
Synced 2026-06-27

What it is

LangExtract is a library for extracting structured information from text. It became noticeable as LLM tasks moved from free-form answers to careful extraction of facts, entities, and relations from documents.

Unstructured text is hard to turn into data: the source must remain traceable, extra facts should not be invented, and fields need links to document spans. The project is best understood not as an abstract repository, but as a concrete answer to a working problem.

In short: LangExtract helps turn long text into structured fields using LLMs with source grounding, making the result easier to verify. If the task matches that shape, the project can provide a fast start without rebuilding the base infrastructure from scratch.

What is inside

The repository contains Python library code, extraction examples, visualization, source handling, tests, and documentation.

LangExtract builds the process around result schema, source text, and verifiable links to text spans. This matters when evaluating the project: it shows which parts are ready, where the core logic lives, and how easy extension may be.

The main technical layer is connected with Python. For a team, this hints at dependencies, environment, and skills needed for adoption or study.

How it is used

It is used for document analysis, entity extraction, dataset preparation, long-text review, and internal knowledge-processing tools.

A good start is a small schema with a few fields and documents where a human can quickly verify each extracted value.

A good first step is a small real scenario end to end: installation, minimal setup, one result, quality check, and notes on limits. That quickly shows where LangExtract helps immediately and where extra work is needed.

After the first run, the working configuration, input data, and expected result should be written down. That turns the first look at LangExtract into a reproducible check rather than a one-off demo impression.

Why it stands out

The strength is focus on result verifiability, not just producing nice JSON output.

It stands out because practical LLM use often depends on reliable extraction from text.

Popularity matters here not as a separate achievement, but as a signal that the problem is familiar to many people. Projects like this last when they provide a clear path from first check to regular use.

Limits

The limitation is that the model can still be wrong, and complex documents need manual review and a good schema.

A working system should store source spans, schema version, model, run parameters, and human-review results.

Even a strong open source project is still a dependency. It needs updates, understanding, documented local settings, and a rollback path if a new version changes behavior.

That makes the project page a starting point for technical evaluation: understand the purpose, repeat a small example, and only then decide whether LangExtract belongs in regular work.

Example

Extraction schema

This example shows how to describe fields that should be extracted from text.

Language: JSON
{
  "fields": ["company", "date", "amount"],
  "source_required": true,
  "review": "human"
}