How amdkhalid8214/docuchat-ai-rag-system works
DocuChat AI turns uploaded documents into searchable, provenance-bearing chunks, then answers questions with hybrid retrieval and grounded generation. Users interact through a React interface and backend APIs; the main paths are document ingestion and question answering, with conversation/authentication and live web knowledge as supporting capabilities. Documented features include PDF bounding-box highlighting, streaming answers, and general/live-web routing. The README and sampled sources support these links; some subsystems, including the frontend internals and web-search dispatch, are not fully shown, so those relationships rely on README documentation.
Main entry points: documents.py Document API · pipeline.py Retrieval Pipeline · chat.py Chat API · main.py API Application
Components 25
Document Ingestion
- Document API
RAG-Based-ChatBot-Main/backend/api/documents.py - Format Converter
RAG-Based-ChatBot-Main/backend/parsers/converter.py - Layout Parser
RAG-Based-ChatBot-Main/backend/parsers/docling_parser.py - Structure Chunker
RAG-Based-ChatBot-Main/backend/chunking/structure_chunker.py - Embedding Service
RAG-Based-ChatBot-Main/backend/embeddings/embedder.py - BM25 Index
RAG-Based-ChatBot-Main/backend/retrieval/bm25.py - Vector Store
RAG-Based-ChatBot-Main/backend/retrieval/vector_store.py - BM25 Cache
RAG-Based-ChatBot-Main/backend/retrieval/bm25.py
Hybrid Retrieval
- Retrieval Pipeline
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Rank Fusion
RAG-Based-ChatBot-Main/backend/retrieval/fusion.py - Chunk Deduplication
RAG-Based-ChatBot-Main/backend/retrieval/dedup.py - Cross-Encoder Reranker
RAG-Based-ChatBot-Main/backend/retrieval/reranker.py
Answering
- Chat API
RAG-Based-ChatBot-Main/backend/api/chat.py - Query Router
RAG-Based-ChatBot-Main/backend/llm/router.py - Query Rewriter
RAG-Based-ChatBot-Main/backend/llm/rewriter.py - Grounded Generator
RAG-Based-ChatBot-Main/backend/llm/generator.py - Live Web Search
RAG-Based-ChatBot-Main/backend/retrieval/web_search.py
Application & State
- React Interface
RAG-Based-ChatBot-Main/frontend/src/App.jsx - API Application
RAG-Based-ChatBot-Main/backend/main.py - Application Database
RAG-Based-ChatBot-Main/backend/db/models.py - Conversation API
RAG-Based-ChatBot-Main/backend/api/conversations.py - Authentication API
RAG-Based-ChatBot-Main/backend/api/auth.py
Other components
- User
- Ollama Service
- Docling Service
Connections 33
- User → React Interface: uses
- React Interface → API Application: requests
- API Application → Document API: mounts
RAG-Based-ChatBot-Main/backend/main.py - API Application → Chat API: mounts
RAG-Based-ChatBot-Main/backend/main.py - API Application → Conversation API: mounts
RAG-Based-ChatBot-Main/backend/main.py - API Application → Authentication API: mounts
RAG-Based-ChatBot-Main/backend/main.py - Document API → Format Converter: converts
RAG-Based-ChatBot-Main/backend/api/documents.py - Document API → Layout Parser: parses
RAG-Based-ChatBot-Main/backend/api/documents.py - Document API → Structure Chunker: chunks
RAG-Based-ChatBot-Main/backend/api/documents.py - Document API → Embedding Service: embeds
RAG-Based-ChatBot-Main/backend/api/documents.py - Document API → Vector Store: indexes vectors
RAG-Based-ChatBot-Main/backend/api/documents.py - Document API → BM25 Index: builds index
RAG-Based-ChatBot-Main/backend/api/documents.py - Layout Parser → Docling Service: parses remotely
RAG-Based-ChatBot-Main/backend/parsers/docling_parser.py - Structure Chunker → Layout Parser: chunks elements
RAG-Based-ChatBot-Main/backend/chunking/structure_chunker.py - BM25 Index → BM25 Cache: persists index
RAG-Based-ChatBot-Main/backend/retrieval/bm25.py - Chat API → Application Database: reads and writes
RAG-Based-ChatBot-Main/backend/api/chat.py - Conversation API → Application Database: reads and writes
RAG-Based-ChatBot-Main/backend/api/conversations.py - Authentication API → Application Database: reads and writes
RAG-Based-ChatBot-Main/backend/api/auth.py - Chat API → Query Router: routes query
RAG-Based-ChatBot-Main/backend/api/chat.py - Chat API → Query Rewriter: rewrites query
RAG-Based-ChatBot-Main/backend/api/chat.py - Chat API → Retrieval Pipeline: retrieves passages
RAG-Based-ChatBot-Main/backend/api/chat.py - Chat API → Grounded Generator: generates answer
RAG-Based-ChatBot-Main/backend/api/chat.py - Retrieval Pipeline → Embedding Service: embeds queries
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Retrieval Pipeline → Vector Store: searches vectors
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Retrieval Pipeline → BM25 Index: searches terms
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Retrieval Pipeline → Rank Fusion: fuses rankings
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Retrieval Pipeline → Chunk Deduplication: deduplicates hits
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Retrieval Pipeline → Cross-Encoder Reranker: reranks candidates
RAG-Based-ChatBot-Main/backend/retrieval/pipeline.py - Grounded Generator → Ollama Service: generates tokens
- Grounded Generator → Live Web Search: uses fallback
RAG-Based-ChatBot-Main/backend/llm/generator.py - Live Web Search → Ollama Service: returns context
- Grounded Generator → React Interface: streams answer
- React Interface → Vector Store: shows provenance