How preethi-sethumadhavan/enterprise_rag_system works
This repository implements an HR policy RAG assistant with two main flows: building a searchable index from policy files and answering employee questions through a Flask API and chat UI. The README documents the UI/API and grounded-answer capabilities; source excerpts show indexing, query handling, retrieval, confidence checks, and OpenAI calls. The index builder and policy files are included as product runtime, not delivery tooling. The UI-to-API relationship is documented, but the template implementation was not sampled.
Main entry points: app.py Hybrid retrieval · build_index.py Text chunker · config.py Configuration · chat.html Chat interface
Components 18
Policy indexing
- Policy documents
data - PDF/TXT loader
build_index.py - Text chunker
build_index.py - Index embeddings
build_index.py - FAISS index
build_index.py - Chunk store
build_index.py
Answer service
- Configuration
config.py - Flask API
app.py - Query rewriting
app.py - Conversation memory
app.py - Query embeddings
app.py - Hybrid retrieval
app.py - Confidence guard
app.py - Grounded answer
app.py - Answer response
app.py
External services
- OpenAI API
User interface
- Chat interface
templates/chat.html
Other components
- Employee
Connections 25
- Policy documents → PDF/TXT loader: reads files
build_index.py - PDF/TXT loader → Text chunker: passes text
build_index.py - Text chunker → Index embeddings: embeds chunks
build_index.py - Index embeddings → OpenAI API: requests embeddings
build_index.py - Index embeddings → FAISS index: adds vectors
build_index.py - Text chunker → Chunk store: saves chunks
build_index.py - Configuration → PDF/TXT loader: configures paths
build_index.py - Configuration → Flask API: configures API
app.py - Employee → Chat interface: asks question
README.md - Chat interface → Flask API: submits question
README.md - Flask API → Query rewriting: rewrites query
app.py - Query rewriting → Conversation memory: reads history
app.py - Query rewriting → OpenAI API: requests rewrite
app.py - Query rewriting → Hybrid retrieval: passes query
app.py - Hybrid retrieval → Query embeddings: embeds query
app.py - Query embeddings → OpenAI API: requests embeddings
app.py - Hybrid retrieval → FAISS index: searches vectors
app.py - Hybrid retrieval → Chunk store: matches chunks
app.py - Hybrid retrieval → Confidence guard: checks results
app.py - Confidence guard → Grounded answer: permits context
app.py - Grounded answer → OpenAI API: requests answer
app.py - Grounded answer → Conversation memory: stores exchange
app.py - Grounded answer → Answer response: returns answer
app.py - Answer response → Flask API: formats JSON
app.py - Flask API → Employee: sends answer
README.md