How sumeetsingh501/ai-app works
The product is an internal, document-grounded Q&A assistant. Employees ask in the Streamlit chat; the app retrieves and reranks relevant passages, combines them with conversation history, and returns an LLM-generated answer with source citations. Document ingestion builds semantic and keyword indexes separately from chat-time retrieval. The graph includes the documented ingestion and hybrid-search stages; source-level connections are cited where excerpts show them, while optional provider choices are shown separately.
Main entry points: retriever.py Retrieval coordinator · app.py Chat UI · ingest.py Index builder · llm.py Grounded answer
Components 18
Document ingestion
- Source documents
data/sample_docs/employee_leave_policy.md - Document loader
rag/ingest.py - Text chunker
rag/ingest.py - Index builder
rag/ingest.py - Vector index
rag/ingest.py - BM25 corpus
rag/ingest.py
Hybrid retrieval
- Retrieval coordinator
rag/retriever.py - Semantic search
rag/retriever.py - Keyword search
rag/retriever.py - Rank fusion
rag/retriever.py - Cross-encoder reranker
rag/retriever.py
Answer generation
- Conversation memory
rag/memory.py - Grounded answer
rag/llm.py
Model providers
- Embedding provider
rag/embeddings.py - OpenAI API
- Anthropic API
Other components
- Employee
- Chat UI
app.py
Connections 21
- Employee → Chat UI: asks question
app.py - Chat UI → Retrieval coordinator: requests passages
app.py - Chat UI → Conversation memory: reads and updates
app.py - Chat UI → Grounded answer: sends question and context
app.py - Source documents → Document loader: loads documents
rag/ingest.py - Document loader → Text chunker: chunks text
rag/ingest.py - Text chunker → Index builder: builds indexes
rag/ingest.py - Index builder → Embedding provider: embeds chunks
rag/ingest.py - Index builder → Vector index: writes vectors
rag/ingest.py - Index builder → BM25 corpus: writes corpus
rag/ingest.py - Retrieval coordinator → Semantic search: runs search
rag/retriever.py - Retrieval coordinator → Keyword search: runs search
rag/retriever.py - Retrieval coordinator → Rank fusion: fuses rankings
rag/retriever.py - Retrieval coordinator → Cross-encoder reranker: reranks candidates
rag/retriever.py - Semantic search → Embedding provider: embeds query
rag/retriever.py - Semantic search → Vector index: searches vectors
rag/retriever.py - Keyword search → BM25 corpus: scores corpus
rag/retriever.py - Grounded answer → OpenAI API: calls when selected
rag/llm.py - Grounded answer → Anthropic API: calls when selected
rag/llm.py - Embedding provider → OpenAI API: calls when selected
rag/embeddings.py - Employee → Chat UI: reads cited answer
README.md