This project is a Full-stack AI invoice processing system that combines OCR, rule-based validation, and a Retrieval-Augmented Generation (RAG) pipeline to automate invoice verification.
The system extracts data from PDF invoices, validates them using multiple agents, retrieves similar historical invoices using vector embeddings, and generates intelligent approval decisions.
-
π PDF Invoice Processing (OCR + text extraction)
-
π€ Multi-Agent Validation System
- Invoice Validation Agent
- Purchase Order (PO) Agent
- Fraud Detection Agent
-
π§ RAG-based Decision Engine (Qdrant + Embeddings)
-
π Semantic Search for Similar Invoices
-
π Confidence-based Decision Making
-
πΎ MongoDB Storage for Invoice History
-
π Full-stack UI with Next.js + Tailwind CSS
User Upload (PDF)
β
Text Extraction (OCR / pdfplumber)
β
Agent Validation (Invoice / PO / Fraud)
β
Embedding Generation (Sentence Transformers)
β
Vector Search (Qdrant)
β
RAG Decision Engine (LLM)
β
Store in MongoDB
β
Display in UI (Next.js Dashboard)
invoice-ai-system/
β
βββ backend/
β βββ controllers/
β β βββ invoice_controller.py # API endpoints (main processing logic)
β β
β βββ services/
β β βββ rag_service.py # RAG + LLM + fallback logic
β β βββ vector_db_service.py # Qdrant operations (store/search)
β β βββ embedding_service.py # Generate embeddings
β β βββ ocr_service.py # PDF text extraction (OCR/pdfplumber)
β β βββ db_service.py # MongoDB operations
β β
β βββ db/
β β βββ mongo.py # MongoDB connection
β β
β βββ main.py # FastAPI app entry point
β βββ requirements.txt # Python dependencies
β βββ .env # Environment variables (USE_LLM)
β
βββ frontend/
β βββ app/
β β βββ page.tsx # Main UI page
β β
β βββ components/
β β βββ invoice-uploader.tsx # Upload PDF component
β β βββ results-panel.tsx # Shows results (decision, agents, similarity)
β β βββ invoice-history.tsx # Displays past invoices
β β
β βββ lib/
β β βββ api.ts # API calls to backend
β β
β βββ types/
β β βββ invoice.ts # TypeScript interfaces
β β
β βββ package.json # Frontend dependencies
β βββ tsconfig.json # TypeScript configuration
β
βββ sample_invoices/ # Test PDFs (pass/hold/fail)
β
βββ README.md # Project documentation
βββ .gitignore
- FastAPI (Python)
- pdfplumber / Tesseract (OCR)
- REST APIs
- Ollama (Local LLM)
- Sentence Transformers (Embeddings)
- Qdrant (Vector Database)
- RAG (Retrieval-Augmented Generation)
- Next.js (TypeScript)
- Tailwind CSS
- MongoDB
- Upload a PDF invoice through the UI
- System extracts text from the document
- Multiple agents validate invoice fields
- Embeddings are generated for the invoice
- Similar invoices are retrieved from Qdrant
- RAG pipeline generates a decision
- Results are stored and displayed in UI
{
"decision": "HOLD",
"confidence": 0.87,
"agent_results": [
{ "agent": "invoice", "status": "pass" },
{ "agent": "po", "status": "pass" },
{ "agent": "fraud", "status": "fail" }
],
"similar_invoices": [
{
"score": 0.92,
"decision": "HOLD"
}
]
}git clone <your-repo-url>
cd backend
pip install -r requirements.txt
python -m uvicorn main:app --reloadAPI Docs:
http://127.0.0.1:8000/docs
cd frontend
npm install
npm run devFrontend URL:
http://localhost:3000
Create a .env file in backend:
USE_LLM=truetrueβ Uses local LLM (Ollama)falseβ Uses fallback logic (for deployment)
pip install -r requirements.txt
- πΉ LangChain integration for RAG pipeline
- πΉ Multi-invoice PDF splitting
- πΉ Cloud deployment (Vercel + Render)
- πΉ Advanced fraud detection models
- πΉ Real-time monitoring dashboard
- Built a full-stack AI system end-to-end
- Implemented RAG architecture with vector search
- Designed multi-agent validation pipeline
- Integrated semantic similarity for decision support
- Developed interactive UI dashboard
This project demonstrates how AI, vector search, and modern web technologies can be combined to build a scalable, intelligent invoice processing system with real-world applications in finance and automation.
Sai Dari


