Catalog / Tools

LangExtract

Python library that uses an LLM to pull structured fields out of long unstructured text, tying every extracted value back to its exact location in the source.

Install

  1. pip (pinned)

    pip install langextract==1.7.0
  2. OpenAI models

    pip install "langextract[openai]==1.7.0"

    Gemini is the default provider; local models work through Ollama.

You describe what to extract in a short prompt plus a few worked examples; LangExtract chunks long documents, runs extraction passes in parallel, and returns typed entities with attributes and character offsets into the original text. It also writes an HTML view that highlights each extraction in context, which makes reviewing labels fast.

When to use it

  • Turning filings, contracts, clinical notes, support tickets or reports into rows and columns.
  • Labeling or tagging a corpus where every label must be traceable to the text that justified it.
  • Building a small classification or extraction dataset to check a model’s accuracy against.

Before you install

The README says it is not an officially supported Google product, though Google publishes and maintains it. Costs are the LLM calls; large documents with several passes add up. Health use is also governed by Google’s Health AI Developer Foundations terms.

Publisher
Google
Works with
Any agent
License
Apache-2.0
Cost
Free

Curated by Andrew Borden-Chisholm. Notes on building with these tools are on the blog.