Repolode
enoch3712

enoch3712/ExtractThinker

Python library that uses LLMs to turn PDFs, images and other documents into validated Pydantic objects, with classification and splitting.

Stars
1,604
Forks
156
Open issues
5
Last commit
2 months ago

What is it?

ExtractThinker is a Python library for extracting typed data from documents. You define a Pydantic contract describing the fields you need, pick a document loader and an LLM, and the library loads, classifies, splits and extracts the content into a validated object.

The library covers the common steps of a document pipeline: document loaders for PDFs, images, tables and spreadsheets, classification and splitting for mixed bundles, and completion strategies for long inputs or incomplete model responses. Local models can be used through Ollama. The main branch also adds page retrieval with SQLite, parallel field extraction, model routing, local entity masking and an MCP service, though these are not yet in a PyPI release and require installing from a checkout.

Schema validation does not guarantee that extracted values are correct, so results should be evaluated on your own documents. Extraction calls the configured model provider and may incur charges.

Key features

  • 01Defines extraction targets as Pydantic models with field constraints and validation.
  • 02Loads PDFs, images, tables and spreadsheets through pluggable document loaders.
  • 03Classifies and splits mixed document bundles into separate documents.
  • 04Supports local models through Ollama and cloud LLM providers.
  • 05Handles long documents and incomplete responses with completion strategies.

Use cases

  • Extracting invoice numbers, totals and supplier details from scanned or digital invoices.
  • Sorting and splitting a bundle of mixed business documents before processing.
  • Building a document pipeline that outputs typed data for downstream Python code.

Quick start

  1. 1

    Install the library from PyPI

    pip install extract-thinker
  2. 2

    Set EXTRACT_THINKER_MODEL and the provider API key, then run the sample extraction script

Things to know

  • Requires an LLM provider and API key, and extraction may incur charges.
  • Scanned documents need OCR or a vision-capable model.
  • The 2026 features on main are not in a PyPI release and require installing from a git checkout.

In collections

Topics

#document-intelligence#llm#pdf#ocr#pydantic#document-parsing#structured-extraction#ai#document-image-analysis#document-processing

FAQ

What is ExtractThinker?
Python library that uses LLMs to turn PDFs, images and other documents into validated Pydantic objects, with classification and splitting. ExtractThinker is a Python library for extracting typed data from documents. You define a Pydantic contract describing the fields you need, pick a document loader and an LLM, and the library loads, classifies, splits and extracts the content into a validated object.
Is ExtractThinker free to use? What license does it have?
ExtractThinker is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is ExtractThinker still maintained?
Updated within 6 months. The last commit to ExtractThinker was on Sep 16, 2026.
What can I use ExtractThinker for?
Extracting invoice numbers, totals and supplier details from scanned or digital invoices. Sorting and splitting a bundle of mixed business documents before processing. Building a document pipeline that outputs typed data for downstream Python code.
How do I install ExtractThinker?
Install the library from PyPI: pip install extract-thinker Set EXTRACT_THINKER_MODEL and the provider API key, then run the sample extraction script
Where can I get ExtractThinker?
The source code and installation instructions are on GitHub: https://github.com/enoch3712/ExtractThinker

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects