How madhusudandesai1/synthese-api-ai-rag-pdf-extractor works
Synthese is a PDF question-answering application. A user uploads a PDF through the browser; the API saves it and schedules background extraction, chunking, and indexing. For questions, the API retrieves a document-specific chunk from ChromaDB, sends grounded context to Gemini, and streams the answer and source snippets back to the browser. The implementation excerpt shows these backend stages in main.py and browser request handling in static/script.js; the README documents the UI and RAG behavior.
Main entry points: main.py FastAPI endpoints · script.js Upload and query client · index.html Web interface · chroma ChromaDB collection
Components 11
Browser interface
- Web interface
static/index.html - Upload and query client
static/script.js
API and processing
- FastAPI endpoints
main.py - Temporary PDF files
main.py - PDF extraction and chunking
main.py
Document retrieval
- ChromaDB collection
data/chroma - Document-scoped search
main.py
Answer generation
- Grounded prompt
main.py - Answer and sources stream
main.py
Other components
- User
- Gemini API
Connections 13
- User → Web interface: uses
README.md - Web interface → Upload and query client: loads
README.md - Upload and query client → FastAPI endpoints: posts upload
static/script.js - Upload and query client → FastAPI endpoints: posts question
static/script.js - FastAPI endpoints → Temporary PDF files: saves PDF
main.py - FastAPI endpoints → PDF extraction and chunking: schedules
main.py - PDF extraction and chunking → ChromaDB collection: stores chunks
main.py - FastAPI endpoints → Document-scoped search: handles query
main.py - Document-scoped search → ChromaDB collection: searches chunks
main.py - Document-scoped search → Grounded prompt: provides context
main.py - Grounded prompt → Gemini API: generates answer
main.py - FastAPI endpoints → Answer and sources stream: returns stream
main.py - Answer and sources stream → Upload and query client: sends answer and sources
static/script.js