enoch3712/ExtractThinker

ExtractThinker is a Document Intelligence library for LLMs, offering ORM-style interaction for flexible and powerful document workflows.

What it solves

ExtractThinker simplifies the process of converting unstructured documents (like PDFs, images, and spreadsheets) into structured, validated Python objects. It removes the manual effort of writing complex parsing logic by allowing users to define the desired data schema using Pydantic contracts.

How it works

The library uses a combination of document loaders, LLMs, and Pydantic for validation. Users define a Contract class to specify the fields and constraints they want to extract. The Extractor then loads the document via a chosen parser, processes the text through an LLM, and maps the output to the validated Pydantic object. For complex workflows, it includes tools for document classification, splitting mixed bundles, and handling long inputs through completion strategies.

Who it’s for

It is designed for developers who need to extract specific data from a variety of document formats and ensure that the resulting data adheres to a strict type and value schema.

Highlights

  • Typed Data Extraction: Uses Pydantic contracts to ensure extracted data is validated and typed.
  • Document Versatility: Supports multiple loaders for PDFs, images, tables, and spreadsheets (including PyMuPDF, Camelot, Tabula, and Adobe).
  • Workflow Tools: Includes built-in capabilities for document classification and splitting.
  • Flexible LLM Integration: Compatible with various providers and local models via Ollama.
  • Advanced Features: Offers parallel field extraction, page retrieval with SQLite, and an MCP service.

Related

  • Project
  • Project
  • Project
  • Project