Skip to main content

Harvest intelligence from any document - AI-powered data extraction and validation

Project description

🌾 Harvestor

AI-powered document data extraction toolkit

Extract structured data from documents (invoices, receipts, forms) using Claude's vision API. Easily integrate into your Python applications with flexible input options and built-in cost tracking.

⚠️ Early Development: This project is in active development. Core functionality is working, but many features are still being built.

What Works Now

  • Vision API Integration: Extract data from images (.jpg, .png, .gif, .webp)
  • Flexible Input: Accepts file paths, bytes, or file-like objects (like PIL, requests)
  • Cost Tracking: Built-in monitoring and limits for API usage
  • Structured Output: Returns Pydantic-validated data models that you can define
  • 🚧 Multi-strategy Extraction: Cost-optimized cascade to reduce api calls (planned)

Quick Start

# Install dependencies
uv sync

# Setup environment
cp .env.template .env
# Add your Anthropic API key to .env

# Run a test
uv run python example.py

Basic Usage

from harvestor import harvest

# From file path
result = harvest("invoice.jpg")
print(f"Invoice #: {result.data.get('invoice_number')}")
print(f"Total: ${result.data.get('total_amount')}")
print(f"Cost: ${result.total_cost:.4f}")

# From bytes (e.g., API upload)
with open("invoice.jpg", "rb") as f:
    data = f.read()
result = harvest(data, filename="invoice.jpg")

# From file-like object
from io import BytesIO
buffer = BytesIO(image_data)
result = harvest(buffer, filename="invoice.jpg")

# Display summary output
print(result.to_summary())

Testing

# Install test dependencies
uv sync --extra dev

# Run tests
make test

# Run with coverage
make test-cov

Requirements

  • Python 3.13
  • Anthropic API key (for Claude vision API)

Citation

For testing and evaluation, we are using the following dataset:

Limam, M., et al. FATURA Dataset. Zenodo, 13 Dec. 2023, https://doi.org/10.5281/zenodo.10371464.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harvestor-0.0.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harvestor-0.0.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file harvestor-0.0.1.tar.gz.

File metadata

  • Download URL: harvestor-0.0.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for harvestor-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2e1c36cd2a7ebb6d5c9b5551aca50509a4c82514f13a457bca7f68f2b361546b
MD5 1e82cc2cd4592ac1823038f9d65636e6
BLAKE2b-256 27b4b8b47c75ce73344cca5b4f9ad8e152119b8b35215e11340d4017c48adff8

See more details on using hashes here.

Provenance

The following attestation bundles were made for harvestor-0.0.1.tar.gz:

Publisher: publish.yml on SIMOUNIX/harvestor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harvestor-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: harvestor-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for harvestor-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff14ce30124720f4b6fc63c6e48f17f766d87056c6d803b965a11c56b08e83c
MD5 5952e02a74e912a9cfa1d6cd9af58163
BLAKE2b-256 8e6263e17e6c765c13caf6809df572a84c211117c470637350c74a3d348d6c8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for harvestor-0.0.1-py3-none-any.whl:

Publisher: publish.yml on SIMOUNIX/harvestor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page