How rakeshganapathy/enterprise-rag-assistant works
This repository implements an enterprise RAG knowledge assistant: users ask questions through a Streamlit UI or API, receive access-filtered answers with citations, and can submit feedback. The central answer path routes queries into semantic or hybrid retrieval, reranks evidence, checks a context-based answer cache, and on misses runs a LangGraph retrieve/grade/rewrite/generate/ground workflow with conversation history. Separate capabilities ingest documents (including S3 events), manage feedback, and evaluate answer quality. The README documents several integrations whose detailed wiring is not present in the sampled source.
Main entry points: qa.py QA orchestration · main.py FastAPI endpoints · pipeline.py Ingestion pipeline · db.py PostgreSQL pgvector
Components 25
User interfaces
- Chat UI
streamlit_app.py - FastAPI endpoints
app/main.py
Identity and access
- JWT and limits
app/auth/dependencies.py - Access filters
app/access/rbac.py
Retrieval and answering
- Query router
app/retrieval/query_router.py - QA orchestration
app/retrieval/qa.py - Hybrid search
app/retrieval/hybrid_search.py - Vector search
app/retrieval/vector_store.py - Cross-encoder
app/retrieval/reranker.py - Answer cache
app/cache/query_cache.py - RAG workflow
app/graph/workflow.py - Workflow stages
app/graph/nodes.py - LLM and embeddings
app/llm.py - Conversation history
app/conversation/store.py
Knowledge lifecycle
- PostgreSQL pgvector
app/db.py - Ingestion pipeline
app/ingestion/pipeline.py - Document loaders
app/ingestion/loaders.py - Chunking
app/ingestion/chunking.py - Document records
app/ingestion/document_store.py - S3 event Lambda
lambda/s3_ingest_trigger.py
Quality and feedback
- Feedback store
app/feedback/store.py - RAGAS evaluation
app/evaluation/runner.py
Other components
- Questioner
- S3 bucket
- OpenAI-compatible service
Connections 37
- Questioner → Chat UI: asks questions
- Chat UI → FastAPI endpoints: calls API
- Questioner → FastAPI endpoints: submits requests
- FastAPI endpoints → JWT and limits: checks claims
- JWT and limits → Access filters: builds access filter
- FastAPI endpoints → QA orchestration: requests answer
- FastAPI endpoints → Ingestion pipeline: requests ingestion
- FastAPI endpoints → Feedback store: stores feedback
- QA orchestration → Query router: selects mode
- QA orchestration → Hybrid search: requests retrieval
- QA orchestration → Vector search: requests retrieval
- Hybrid search → Vector search: runs dense search
- QA orchestration → Cross-encoder: reranks results
- QA orchestration → Answer cache: checks and stores
- QA orchestration → RAG workflow: runs on cache miss
- RAG workflow → Workflow stages: dispatches stages
- Workflow stages → QA orchestration: retrieves context
- Workflow stages → LLM and embeddings: rewrites and generates
- Workflow stages → Conversation history: reads history
- Workflow stages → PostgreSQL pgvector: reads history
- Vector search → PostgreSQL pgvector: searches chunks
- Answer cache → PostgreSQL pgvector: reads and writes
- Conversation history → PostgreSQL pgvector: reads and writes
- Ingestion pipeline → Document loaders: extracts content
- Ingestion pipeline → Chunking: splits documents
- Ingestion pipeline → LLM and embeddings: embeds chunks
- Ingestion pipeline → Vector search: indexes chunks
- Ingestion pipeline → Document records: tracks versions
- Document records → PostgreSQL pgvector: stores records
- S3 bucket → S3 event Lambda: sends events
- S3 event Lambda → S3 bucket: reads tags and signs URL
- S3 event Lambda → FastAPI endpoints: posts ingest event
- Ingestion pipeline → S3 bucket: downloads object
- LLM and embeddings → OpenAI-compatible service: calls model services
- FastAPI endpoints → RAGAS evaluation: evaluation capability
- RAGAS evaluation → QA orchestration: runs questions through
- Feedback store → PostgreSQL pgvector: stores and reads