A Streamlit-based web interface for processing invoice images using DSPy agents and Liquid Foundational Models.
- Invoice Image Processing: Upload and process multiple invoice images simultaneously
- Liquid AI Models: Uses LFM2-VL-3B for OCR and LFM2-1.2B-Extract for data extraction
- DSPy Integration: Leverages DSPy framework for agent-based processing workflows
- Real-time Processing: Live progress tracking and processing traces
- Export Options: Download results as CSV or JSON files
- Error Recovery: Intelligent error handling with retry mechanisms
- Multiple Model Support: Support for Ollama, Gemini, and OpenAI models
- Python 3.9+
- uv package manager (recommended) or pip
- Ollama (for local model inference) OR API keys for cloud models
# Clone or navigate to the project directory
cd dspy-liquid-agent
# Install dependencies
uv sync
# Activate the environment
source .venv/bin/activate # On Windows: .venv\Scripts\activateCreate a .env file in the project root:
# For Ollama (local)
OLLAMA_BASE_URL=http://localhost:11434- Install Ollama: https://ollama.ai/
- Pull the required models:
ollama pull hf.co/LiquidAI/LFM2-VL-3B-GGUF:F16
ollama pull hf.co/LiquidAI/LFM2-1.2B-Extract-GGUF:F16# With uv
uv run streamlit run src/invoice_parser_ui/app.py
# With pip
streamlit run src/invoice_parser_ui/app.py- Upload Invoices: Use the file uploader to select invoice images (PNG, JPG, JPEG, etc.)
- Configure Models: Select the vision and extraction models
- Choose Output Format: Select CSV or JSON output
- Process: Click "🚀 Process Invoices" to start processing
- Download Results: Use the export options to download processed data
- InvoiceAgent: Main processing agent using DSPy and Liquid models
- Streamlit UI: Web interface for file upload and result visualization
- DSPy Integration: Agent-based workflow orchestration
- Model Management: Support for multiple AI model providers
- Image Upload: User uploads invoice images
- Text Extraction: LFM2-VL-3B extracts text from images
- Data Structuring: LFM2-1.2B-Extract converts text to structured data
- Validation: Results are validated and formatted
- Export: Final results are made available for download
dspy-liquid-agent/
├── src/invoice_parser_ui/
│ ├── app.py # Main Streamlit application
│ ├── agents/
│ │ ├── invoice_agent.py # Core invoice processing agent
│ │ └── __init__.py
│ ├── common/
│ │ ├── dspy_setup.py # DSPy configuration utilities
│ │ └── __init__.py
│ ├── config/
│ │ ├── agent_configs.py # Model and agent configurations
│ │ └── __init__.py
│ └── __init__.py
├── pyproject.toml # Project configuration
├── README.md # This file
└── uv.lock # Dependency lock file
- New Agent Types: Extend the
agents/directory - UI Components: Add to
components/directory - Model Support: Update
config/agent_configs.pyandcommon/dspy_setup.py
- "Model not found" errors: Ensure Ollama models are downloaded
- Import errors: Check that all dependencies are installed
- Connection errors: Verify API keys and network connectivity
- Processing failures: Check invoice image quality and format
Check the .sprint/invoice_parser.log file for detailed error information.
This project is part of the Liquid AI ecosystem. See individual component licenses for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For support and questions:
- Check the troubleshooting section above
- Review the Liquid AI documentation
- Join the Liquid AI Discord community