ExtractThinker
A Python document extraction library that uses local Ollama or cloud models and validates results with Pydantic. Open source under Apache 2.0.

ExtractThinker is a Python library for developers who want to extract structured data from documents using models running locally through Ollama. It also supports OpenAI, Anthropic and Groq. With a cloud provider, extraction sends document content to that service, requires provider credentials and may incur charges.
Its Pydantic contracts describe the fields an application expects, including value constraints and application rules. The library validates model responses against those contracts and raises errors for invalid results rather than silently filling required fields with invented defaults. Ollama integration supports native structured output when the model and server support it, with validation still applied to the returned object.
Document loaders cover PDFs, images, tables and spreadsheets. Scans require OCR or a vision-capable model; image-based extraction needs a loader that supplies page images. Classification and splitting help process bundles containing different document types.
For long documents, pagination extracts individual pages and validates the merged result. Page selection can reduce the material sent to a model. Unresolved conflicts or failed pages raise errors instead of producing incomplete data.
The library runs on macOS, Windows and Linux and is open source under Apache 2.0. Document loading can work without a model call or provider credentials. Schema validation checks structure and constraints; extracted values can still be factually wrong.