Structured data extraction, instruction calling and agentic workflows with ML, LLM and Vision LLM
Structured data extraction, instruction calling and agentic workflows with ML, LLM and Vision LLM
Structured data extraction, instruction calling and agentic workflows with ML, LLM and Vision LLM
Sparrow is an API-first platform for enterprise document intelligence. It combines accurate structured extraction from documents (invoices, statements, tables) with workflow agents and decision agents.
Try Sparrow Online | Quick Start | ️ Installation | Examples | Agents
Production-ready structured data extraction powered by ML, LLMs & Vision LLMs. Turn invoices, receipts, statements, forms and images into clean structured data.
Sparrow is an API-first platform built for enterprise document intelligence. It provides RESTful APIs for structured data extraction, instruction processing, and multi-agent workflow orchestration — all running on your own infrastructure with no external API calls or cloud dependencies.
Platform capabilities:
The web UI provides a visual interface on top of the same API:
Universal Document Processing: Handle invoices, receipts, forms, bank statements, tables
Pluggable Architecture: Mix and match different pipelines (Sparrow Parse, Instructor, Agents)
️ Multiple Backends: MLX, Ollama, vLLM, Docker, Hugging Face Cloud GPU, Mistral OCR
Multi-format Support: Images (PNG, JPG) and multi-page PDFs
Schema Validation: JSON schema-based extraction with automatic validation
API-First Design: RESTful APIs for easy integration
Instruction Calling: Text processing, validation, decision making with Gemma, Mistral, Qwen 3.6, etc.
Visual Monitoring: Built-in dashboard and agent workflow tracking
Enterprise Ready: Rate limiting, usage analytics, commercial licensing available
Local Vision LLMs: Mistral, Qwen 3.6, DeepSeek OCR, dots.ocr, Gemma 4, etc.
☁️ Cloud OCR Backend: Mistral OCR for cloud document extraction
| Component | Purpose | Use Case |
|---|---|---|
| Sparrow ML LLM | Main API engine | Document processing pipelines |
| Sparrow Parse | Vision LLM library | Structured JSON extraction |
| Sparrow Agents | Workflow orchestration | Complex multi-step processing |
| Sparrow OCR | Text recognition | OCR preprocessing |
| Sparrow UI | Web interface | Interactive document processing |
pyenv for version management)# 1. Install pyenv and Python 3.12.10
pyenv install 3.12.10
pyenv global 3.12.10
# 2. Create virtual environment
python -m venv .env_sparrow_parse
source .env_sparrow_parse/bin/activate # Linux/Mac
# or .env_sparrow_parse\Scripts\activate # Windows
# 3. Install Sparrow Parse pipeline
git clone https://github.com/katanaml/sparrow.git
cd sparrow/sparrow-ml/llm
pip install -r requirements_sparrow_parse.txt
# 4. For macOS: Install poppler for PDF processing
brew install poppler
# 5. Start the API server
python api.pyBefore running pip install -r requirements_sparrow_parse.txt, check your platform. If you are on macOS and want to run MLX backend, go to requirements_sparrow_parse.txt and make sure sparrow-parse[mlx] libary reference is defined. If you are running Sparrow on Linux/Windows, make sure to use sparrow-parse library reference, this will skip MLX related libraries.
# Extract data from a bonds table
./sparrow.sh '[{"instrument_name":"str", "valuation":0}]' \
--pipeline "sparrow-parse" \
--options mlx \
--options mlx-community/Qwen2.5-VL-72B-Instruct-4bit \
--file-path "data/bonds_table.png"Result:
{
"data": [
{"instrument_name": "UNITS BLACKROCK...", "valuation": 19049},
{"instrument_name": "UNITS ISHARES...", "valuation": 83488}
],
"valid": "true"
}Use --options mlx for MLX backend, --options ollama for Ollama backend, --options vllm for vLLM backend, --options mistral for Mistral OCR cloud backend. Make sure to provide correct Vision LLM model name, download model first separately with MLX, vLLM or Ollama.
# 1. Clone repository
git clone https://github.com/katanaml/sparrow.git
cd sparrowFor complete installation instructions, see our detailed environment setup guide.
.env_sparrow_parse - for Sparrow Parse (Vision LLM).env_instructor - for Instructor (Text LLM) .env_ocr - for OCR service (optional)pip install -r requirements_sparrow_parse.txt
macOS:
brew install poppler # Required for PDF processingUbuntu/Debian:
sudo apt-get install poppler-utils libpoppler-cpp-devApple Silicon: MLX backend available for optimal performance
NVIDIA/AMD GPU: Use vLLM or Ollama backend
Cloud: Use Mistral OCR backend
CPU Only: Use smaller models or Hugging Face cloud backend
# Test installation
python api.py --port 8002
# Visit http://localhost:8002/api/v1/sparrow-llm/docs# Extract all data from bank statement
./sparrow.sh "*" \
--pipeline "sparrow-parse" \
--options mlx \
--options mlx-community/Qwen2.5-VL-72B-Instruct-4bit \
--file-path "data/bank_statement.pdf"…# Extract structured data from financial table
./sparrow.sh '[{"instrument_name":"str", "valuation":0}]' \
--pipeline "sparrow-parse" \
--options mlx \
--options mlx-community/Qwen2.5-VL-72B-Instruct-4bit \
--file-path "data/bonds_table.png"…# Extract invoice with cropping for better accuracy
./sparrow.sh "*" \
--pipeline "sparrow-parse" \
--options mlx \
--options mlx-community/Qwen2.5-VL-72B-Instruct-4bit \
--crop-size 60 \
--file-path "data/invoice.pdf"…# Process multi-page PDF with structured output per page
./sparrow.sh '{"table": [{"description": "str", "latest_amount": 0, "previous_amount": 0}]}' \
--pipeline "sparrow-parse" \
--options mlx \
--options mlx-community/Qwen2.5-VL-72B-Instruct-4bit \
--file-path "data/financial_report.pdf" \
--debug-dir "debug/"…# Instruction-based processing
./sparrow.sh "instruction: do arithmetic operation, payload: 2+2=" \
--pipeline "sparrow-instructor" \
--options mlx \
--options lmstudio-community/Mistral-Small-3.2-24B-Instruct-2506-8bit
# Instruction processing with document input
./sparrow.sh "check if business entity Chapman, Kim and Green is invoice issuing party"
--pipeline "sparrow-parse"
--instruction
--options mlx --options lmstudio-community/Mistral-Small-3.2-24B-Instruct-2506-8bit
--file-path "invoice_1.jpg"JSON Output:
The result of 2 + 2 is:
4# Function calling example
./sparrow.sh assistant --pipeline "stocks" --query "Oracle"JSON Output:
{
"company": "Oracle Corporation",
"ticker": "ORCL"
}Additional Output:
The stock price of the Oracle Corporation is 186.3699951171875. USD./sparrow.sh "{\"items\": [{\"instrument_name\":\"str\", \"quantity\": \"float\", \"valuation\":\"int\"}]}" \
--pipeline "sparrow-parse" \
--debug --table --table-template "sparrow_generic_table" \
--options mlx --options mlx-community/Ministral-3-14B-Instruct-2512-8bit \
--options mlx --options mlx-community/dots.ocr-bf16 --file-path "data/bonds_table.png" ./sparrow.sh "[{\"instrument_name\":\"str\", \"valuation\":\"int\"}]" \
--pipeline "sparrow-parse" --debug --options mlx \
--options mlx-community/gemma-4-31b-it-8bit \
--file-path "data/bonds_table.png" --hints-file-path "data/llm_hints_eu.json" ./sparrow.sh "<JSON_SCHEMA>" --pipeline "<PIPELINE>" [OPTIONS] --file-path "<FILE>"| Argument | Type | Description | Example |
|---|---|---|---|
query |
JSON/String | Schema or instruction | '[{"field":"str"}]' |
--pipeline |
String | Pipeline to use | sparrow-parse |
--file-path |
Path | Input document | data/invoice.pdf |
--hints-file-path |
Path | Query hints | data/hints.json |
--options |
String | Backend configuration | mlx,model-name |
--instruction |
Boolean | Sparrow query will be used as instruction | --instruction |
--validation |
Boolean | Sparrow query will be used for field validation | --validation |
--markdown |
Boolean | Markdown pre-processing | --markdown |
--ocr |
Boolean | Experimental functionality | --ocr |
--table |
Boolean | Experimental functionality | --table |
--table-template |
String | Experimental functionality | --name |
--crop-size |
Integer | Border cropping pixels | 60 |
| `- |
No open issues yet, or sync has not completed.