How nithyaviswak/enterprise_rag_chatbot works
Enterprise RAG chatbot: users upload documents and ask questions through a Next.js interface; the FastAPI backend ingests and indexes documents, retrieves grounded context, generates and verifies answers, then streams answers and sources. Separate branches provide knowledge-graph exploration, evaluation/metrics, and enterprise controls. The README documents several product capabilities whose implementations were not sampled; those are represented at their supported directory or module paths, with uncertain wiring omitted.
Main entry points: api.ts API client · pipeline.py RAG orchestration · main.py FastAPI app · retriever.py Hybrid retrieval
Components 27
Chat interface
- Chat UI
frontend/src/components/ChatInterface.tsx - Chat messages
frontend/src/components/ChatMessage.tsx - File upload
frontend/src/components/FileUpload.tsx - Graph explorer
frontend/src/components/GraphExplorer.tsx - API client
frontend/src/lib/api.ts
API and governance
- FastAPI app
backend/app/main.py - Chat endpoint
backend/app/routers/chat.py - Document endpoints
backend/app/routers/documents.py - Auth and limits
backend/app/middleware/auth.py - Chat orchestration
backend/app/services/chat_service.py
RAG pipeline
- Document ingestion
backend/app/rag/ingestion.py - RAG orchestration
backend/app/rag/pipeline.py - Hybrid retrieval
backend/app/rag/retriever.py - Vector store
backend/app/services/vector_store.py - Embeddings
backend/app/services/embedding_service.py - Grounded generation
backend/app/rag/generator.py - Retrieval guardrails
backend/app/rag/guardrails.py - Grounding checks
backend/app/rag/hallucination.py - Gemini service
backend/app/services/gemini_service.py - RAGFlow plugin
backend/app/services/ragflow_client.py
Knowledge graph
- Graph API
backend/app/routers/graph.py - Graph services
backend/app/services/knowledge_graph/graph_service.py
Quality and observability
- Evaluation API
backend/app/routers/evaluation.py - Evaluation service
backend/app/services/evaluation_service.py - Request tracing
backend/app/observability/tracing.py - Evaluation metrics
evaluation/metrics.py
Other components
- User
Connections 31
- User → Chat UI: asks
- Chat UI → API client: uses
frontend/src/components/ChatInterface.tsx - API client → Chat endpoint: sends chat
- Chat endpoint → Chat orchestration: delegates
- Chat orchestration → RAG orchestration: runs RAG
- RAG orchestration → Hybrid retrieval: retrieves
backend/app/rag/pipeline.py - Hybrid retrieval → Vector store: searches
backend/app/rag/retriever.py - Hybrid retrieval → Embeddings: embeds query
backend/app/rag/retriever.py - Hybrid retrieval → RAGFlow plugin: retrieves optionally
- RAG orchestration → Retrieval guardrails: checks context
backend/app/rag/pipeline.py - RAG orchestration → Grounded generation: generates
backend/app/rag/pipeline.py - RAG orchestration → Grounding checks: verifies answer
backend/app/rag/pipeline.py - Grounded generation → Gemini service: calls model
- User → File upload: uploads files
- File upload → API client: submits file
- API client → Document endpoints: uploads
- Document endpoints → Document ingestion: ingests
- Document ingestion → Embeddings: embeds documents
- FastAPI app → Chat endpoint: registers
backend/app/main.py - FastAPI app → Document endpoints: registers
backend/app/main.py - FastAPI app → Graph API: registers
backend/app/main.py - FastAPI app → Auth and limits: configures middleware
backend/app/main.py - User → Graph explorer: explores graph
- Graph explorer → API client: requests graph
- API client → Graph API: queries graph
- Graph API → Graph services: uses graph
- API client → Evaluation API: requests metrics
- Evaluation API → Evaluation service: delegates
backend/app/routers/evaluation.py - RAG orchestration → Request tracing: records stages
backend/app/rag/pipeline.py - Evaluation service → Evaluation metrics: computes metrics
- Chat UI → Chat messages: renders
frontend/src/components/ChatInterface.tsx