How arnobt78/rag-pdf-chat-multi-agent-pipeline--python-react-fullstack works
RAG PDF Chat is a browser-based document assistant: users upload a PDF, then ask questions grounded in its contents. The backend extracts and chunks the document, embeds and indexes it per anonymous session, retrieves relevant passages, and generates answers through a multi-agent pipeline with provider failover; answers may stream over SSE. The frontend also offers local chat history and preferences, plus health/status and optional Sentry capabilities. Some connections are supported by README documentation rather than sampled implementation; unsampled details are not inferred.
Main entry points: chat-container.tsx Chat interface · main.py FastAPI application · vector_store.py FAISS index and retrieval · upload.py PDF upload
Components 22
Browser app
- Chat interface
frontend/src/components/chat/chat-container.tsx - Chat controls
frontend/src/components/chat - Local chat data
frontend/src/lib/storage.ts - Session and preferences
frontend/src/lib/chat-session.ts - App routes
frontend/src/App.tsx
API routes
- FastAPI application
backend/app/main.py - PDF upload
backend/app/routes/upload.py - Chat endpoints
backend/app/routes/chat.py - Health and status
backend/app/routes
Document RAG
- PDF extraction and chunking
backend/app/services/pdf_processor.py - FAISS index and retrieval
backend/app/services/vector_store.py - Embedding providers
backend/app/services/embedding_clients.py
Answer generation
- Multi-agent pipeline
backend/app/agents/pipeline.py - Agent stages
backend/app/agents - LLM failover
backend/app/services/llm_service.py
Session and operations
- Session vector registry
backend/app/services/session_vector_registry.py - Rate limiting
backend/app/services/ip_rate_limit.py - Usage counters
backend/app/services/usage_counters.py - FAISS session cleanup
backend/app/services/faiss_session_cleanup.py
Other components
- Visitor
- External model providers
- Sentry
Connections 24
- Visitor → Chat interface: asks questions
README.md - App routes → Chat interface: routes to
frontend/src/App.tsx - Chat interface → Chat controls: uses controls
frontend/src/components/chat/chat-container.tsx - Chat interface → Local chat data: stores history
README.md - Chat interface → Session and preferences: uses session identity
README.md - Chat interface → FastAPI application: calls API
README.md - FastAPI application → PDF upload: registers routes
backend/app/main.py - FastAPI application → Chat endpoints: registers routes
backend/app/main.py - FastAPI application → Health and status: registers routes
backend/app/main.py - PDF upload → PDF extraction and chunking: processes PDF
backend/app/routes/upload.py - PDF upload → Session vector registry: gets session store
backend/app/routes/upload.py - PDF upload → FAISS index and retrieval: writes chunks
backend/app/routes/upload.py - Session vector registry → FAISS index and retrieval: creates stores
backend/app/services/session_vector_registry.py - FAISS index and retrieval → Embedding providers: creates embeddings
backend/app/services/vector_store.py - FAISS index and retrieval → External model providers: requests embeddings
- Chat endpoints → Multi-agent pipeline: runs pipeline
backend/app/routes/chat.py - Chat endpoints → Rate limiting: checks ask limit
backend/app/routes/chat.py - Chat endpoints → Usage counters: updates counters
backend/app/routes/chat.py - Multi-agent pipeline → FAISS index and retrieval: retrieves passages
backend/app/agents/pipeline.py - Multi-agent pipeline → Agent stages: executes stages
backend/app/agents/pipeline.py - Multi-agent pipeline → LLM failover: generates answer
backend/app/agents/pipeline.py - LLM failover → External model providers: fails over
backend/app/services/llm_service.py - FastAPI application → FAISS session cleanup: prunes indexes
backend/app/main.py - Chat interface → Sentry: reports errors