How vietdocmemory/vietnamese-rag-system works
Vietnamese RAG serves document-grounded question answering: a user uploads a PDF, waits for processing, then asks a question and receives streamed text with source chunks. The documented flow includes Vietnamese-aware structural chunking, hybrid dense/sparse retrieval, reranking and diversity filtering, and context-limited generation. The API coordinates these stages; Redis caching and upload status support the workflow. The README also describes a separate evaluation and root-cause-analysis capability. Some router and evaluation internals were not sampled, so links are limited to documented or evidenced ownership.
Main entry points: chat.py Chat routes · document.py Document routes · vector_store.py Vector management · evaluator.py Evaluation pipeline
Components 17
User interfaces
- Streamlit UI
src/ui/streamlit_app.py
API orchestration
- FastAPI app
src/api/main.py - Document routes
src/api/routers/document.py - Chat routes
src/api/routers/chat.py - Cache and status
src/core/cache.py - Redis
Document ingestion
- PDF chunking
src/ingestion/pdf_loader.py - Vector management
src/ingestion/vector_store.py - Qdrant
Question answering
- Hybrid retrieval
src/retrieval/search_engine.py - Embedding model
src/core/model_manager.py - Answer generation
src/generation/generator.py - Ollama LLM
Evaluation
- Evaluation pipeline
src/evaluation/evaluator.py - LLM judge
- Evaluation reports
src/evaluation/evaluator.py
Other components
- Document user
Connections 22
- Document user → Streamlit UI: uploads and asks
- Streamlit UI → Document routes: uploads and polls
- Streamlit UI → Chat routes: sends questions
- FastAPI app → Document routes: registers routes
- FastAPI app → Chat routes: registers routes
- Document routes → PDF chunking: processes PDF
- Document routes → Vector management: stores chunks
- PDF chunking → Vector management: provides chunks
- Vector management → Embedding model: encodes chunks
- Vector management → Qdrant: upserts vectors
- Document routes → Cache and status: updates status
- Vector management → Qdrant: searches vectors
- Chat routes → Cache and status: checks and saves
- Cache and status → Redis: reads and writes
- Chat routes → Hybrid retrieval: searches query
- Hybrid retrieval → Qdrant: hybrid searches
- Hybrid retrieval → Embedding model: embeds and filters
- Chat routes → Answer generation: generates answer
- Answer generation → Ollama LLM: streams prompt
- Evaluation pipeline → Chat routes: queries API
- Evaluation pipeline → LLM judge: grades answers
- Evaluation pipeline → Evaluation reports: writes metrics