How prabhakaranvijay/prod-rag works
Prod-RAG is a FastAPI RAG backend. Users ingest local files or URLs for indexing, then ask questions answered from retrieved and reranked document chunks; document listing/deletion and health/readiness checks are also supported. The graph shows API ownership, ingestion stages, retrieval, generation, and the Chroma-backed index. README documents query rewriting and Ragas evaluation; evaluation is shown as a separate capability. Edges follow excerpted calls or explicit README statements; unsampled routing details are omitted.
Main entry points: rag_service.py RAG service · main.py FastAPI app · retriever.py Search orchestrator · pipeline.py Ingestion pipeline
Components 22
Service API
- FastAPI app
app/main.py - Chat routes
app/api/routes/chat.py - Document routes
app/api/routes/documents.py - Health probes
app/api/routes/health.py - RAG service
app/services/rag_service.py
Document ingestion
- Ingestion pipeline
app/ingestion/pipeline.py - Document loading
app/ingestion/loader.py - Metadata enrichment
app/ingestion/metadata.py - Document chunking
app/ingestion/chunker.py
Search and ranking
- Search orchestrator
app/retrieval/retriever.py - Hybrid search
app/retrieval/hybrid_search.py - Vector search
app/retrieval/vector_search.py - BM25 search
app/retrieval/bm25.py - Cross-encoder reranker
app/reranking/bge_reranker.py
Answer generation
- RAG chain
app/chains/rag_chain.py - Groq generation
app/llm/groq.py
Index and evaluation
- Chroma index
app/vectorstore/chroma.py - BGE embeddings
app/embeddings/embedding_factory.py - Ragas evaluation
evaluation/ragas_eval.py - Evaluation runner
evaluation/runner.py
Other components
- API client
- Groq API
Connections 27
- API client → FastAPI app: sends requests
- FastAPI app → Chat routes: mounts routes
app/main.py - FastAPI app → Document routes: mounts routes
app/main.py - FastAPI app → Health probes: mounts routes
app/main.py - Chat routes → RAG service: calls
app/api/routes/chat.py - Document routes → RAG service: calls
app/api/routes/documents.py - FastAPI app → RAG service: initializes
app/main.py - RAG service → Ingestion pipeline: runs ingestion
app/services/rag_service.py - Ingestion pipeline → Document loading: loads documents
app/ingestion/pipeline.py - Ingestion pipeline → Metadata enrichment: enriches metadata
app/ingestion/pipeline.py - Ingestion pipeline → Document chunking: splits documents
app/ingestion/pipeline.py - RAG service → Search orchestrator: indexes chunks
app/services/rag_service.py - RAG service → RAG chain: asks question
app/services/rag_service.py - RAG chain → Search orchestrator: searches query
app/chains/rag_chain.py - Search orchestrator → Hybrid search: dispatches search
app/retrieval/retriever.py - Search orchestrator → Vector search: dispatches vector
app/retrieval/retriever.py - Search orchestrator → BM25 search: dispatches keyword
app/retrieval/retriever.py - Hybrid search → Vector search: combines results
app/retrieval/hybrid_search.py - Hybrid search → BM25 search: combines results
app/retrieval/hybrid_search.py - Hybrid search → Cross-encoder reranker: reranks candidates
app/retrieval/hybrid_search.py - Vector search → Chroma index: queries index
app/retrieval/vector_search.py - Vector search → Chroma index: writes and lists
app/retrieval/vector_search.py - Chroma index → BGE embeddings: creates embeddings
app/vectorstore/chroma.py - RAG chain → Groq generation: generates answer
app/chains/rag_chain.py - Groq generation → Groq API: requests completion
- Evaluation runner → RAG service: runs pipeline
evaluation/runner.py - Evaluation runner → Ragas evaluation: scores results
evaluation/runner.py