How starryroses/groundrag-hybrid-retrieval-grounded-generation-system works
Advanced RAG is a BBC News research assistant: users submit questions with conversation history, receive evidence-grounded answers and citations, and can inspect retrieved evidence. The backend loads and prepares the corpus at startup, then rewrites each query, retrieves through lexical and dense search, fuses and reranks results, and applies grounding, generation, verification, and citation checks. The frontend and API excerpts show the request/response path; several grounding and retrieval relationships are supported by the pipeline’s imports but their implementations were not sampled.
Main entry points: rag_pipeline.py RAG pipeline · App.jsx Chat app · container.py RAG container · routes.py Query endpoint
Components 27
User experience
- Chat app
frontend/src/App.jsx - Chat window
frontend/src/components/ChatWindow.jsx - Message bubbles
frontend/src/components/MessageBubble.jsx - Chat input
frontend/src/components/ChatInput.jsx - Evidence panel
frontend/src/components/EvidencePanel.jsx - API client
frontend/src/services/api.js
API and orchestration
- Query endpoint
src/api/routes.py - RAG container
src/app/container.py - RAG pipeline
src/pipeline/rag_pipeline.py
Corpus preparation
- BBC corpus loader
src/ingestion/bbc_loader.py - Text preprocessing
src/nlp/preprocess.py - Document chunker
src/ingestion/chunker.py - Document and result models
src/models.py
Retrieval and ranking
- Query rewriter
src/generation/query_rewriter.py - BM25 search
src/retrieval/bm25.py - Dense search
src/retrieval/dense.py - Persistent vector store
- Rank fusion
src/retrieval/rrf.py - Cross-encoder reranker
src/reranking/cross_encoder.py
Grounded answers
- Grounding decision
src/grounding/decision.py - Evidence context
src/grounding/context.py - Grounded prompt
src/grounding/prompt.py - Groq language model
src/generation/groq_llm.py - Answer verifier
src/grounding/verifier.py - Citation validation
src/grounding/citations.py
Other components
- Researcher
- Groq service
Connections 29
- Researcher → Chat app: asks
frontend/src/App.jsx - Chat app → Chat input: renders
frontend/src/App.jsx - Chat app → Chat window: renders
frontend/src/App.jsx - Chat window → Message bubbles: renders
frontend/src/components/ChatWindow.jsx - Chat app → Evidence panel: renders
frontend/src/App.jsx - Chat app → API client: calls
frontend/src/App.jsx - API client → Query endpoint: sends query
- Query endpoint → RAG container: calls
src/api/routes.py - RAG container → RAG pipeline: constructs and calls
src/app/container.py - RAG container → BBC corpus loader: loads corpus
src/app/container.py - RAG container → Text preprocessing: preprocesses documents
src/app/container.py - RAG container → Document chunker: chunks documents
src/app/container.py - BBC corpus loader → Document and result models: creates documents
src/ingestion/bbc_loader.py - Document chunker → Document and result models: creates chunks
src/ingestion/chunker.py - RAG pipeline → Query rewriter: rewrites query
src/pipeline/rag_pipeline.py - RAG pipeline → BM25 search: searches query
src/pipeline/rag_pipeline.py - RAG pipeline → Dense search: searches query
src/pipeline/rag_pipeline.py - RAG pipeline → Rank fusion: fuses results
src/pipeline/rag_pipeline.py - RAG pipeline → Cross-encoder reranker: reranks results
src/pipeline/rag_pipeline.py - Dense search → Persistent vector store: queries and indexes
src/retrieval/dense.py - RAG pipeline → Grounding decision: checks evidence
src/pipeline/rag_pipeline.py - RAG pipeline → Evidence context: builds context
src/pipeline/rag_pipeline.py - RAG pipeline → Grounded prompt: builds prompt
src/pipeline/rag_pipeline.py - RAG pipeline → Groq language model: generates answer
src/pipeline/rag_pipeline.py - Groq language model → Groq service: requests completion
src/generation/groq_llm.py - RAG pipeline → Answer verifier: verifies answer
src/pipeline/rag_pipeline.py - RAG pipeline → Citation validation: validates and builds citations
src/pipeline/rag_pipeline.py - Chat app → Query endpoint: displays response
- Chat app → Evidence panel: selects evidence
frontend/src/App.jsx