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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1c36cd2a7ebb6d5c9b5551aca50509a4c82514f13a457bca7f68f2b361546b
|
|
| MD5 |
1e82cc2cd4592ac1823038f9d65636e6
|
|
| BLAKE2b-256 |
27b4b8b47c75ce73344cca5b4f9ad8e152119b8b35215e11340d4017c48adff8
|
Provenance
The following attestation bundles were made for harvestor-0.0.1.tar.gz:
Publisher:
publish.yml on SIMOUNIX/harvestor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
harvestor-0.0.1.tar.gz -
Subject digest:
2e1c36cd2a7ebb6d5c9b5551aca50509a4c82514f13a457bca7f68f2b361546b - Sigstore transparency entry: 872237300
- Sigstore integration time:
-
Permalink:
SIMOUNIX/harvestor@1c23bc395d0a5ef63ceeb7d41b4f703f07b4d8e3 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/SIMOUNIX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c23bc395d0a5ef63ceeb7d41b4f703f07b4d8e3 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ff14ce30124720f4b6fc63c6e48f17f766d87056c6d803b965a11c56b08e83c
|
|
| MD5 |
5952e02a74e912a9cfa1d6cd9af58163
|
|
| BLAKE2b-256 |
8e6263e17e6c765c13caf6809df572a84c211117c470637350c74a3d348d6c8a
|
Provenance
The following attestation bundles were made for harvestor-0.0.1-py3-none-any.whl:
Publisher:
publish.yml on SIMOUNIX/harvestor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
harvestor-0.0.1-py3-none-any.whl -
Subject digest:
1ff14ce30124720f4b6fc63c6e48f17f766d87056c6d803b965a11c56b08e83c - Sigstore transparency entry: 872237307
- Sigstore integration time:
-
Permalink:
SIMOUNIX/harvestor@1c23bc395d0a5ef63ceeb7d41b4f703f07b4d8e3 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/SIMOUNIX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c23bc395d0a5ef63ceeb7d41b4f703f07b4d8e3 -
Trigger Event:
release
-
Statement type: