How yousefahmednm8-png/rag-study-assistant works
RAG Study Assistant lets a learner upload PDF/TXT study materials, build a local searchable index, and ask questions answered with source citations. The documented flow is ingestion, chunking, embedding/indexing, dense retrieval, reranking, prompt construction, and Ollama generation; the Streamlit app handles upload and question interaction. The graph includes BM25 as a distinct evaluation capability and the FAISS-backed persistent store. Evidence for runtime links comes from excerpts and README; the deeper internals of generation and unexcerpted UI behavior were not inspected.
Main entry points: pipeline.py RAG orchestrator · app.py Streamlit app · vector_store.py FAISS vector store · evaluate.py Retrieval evaluation
Components 14
Study assistant UI
- Streamlit app
app.py
Document preparation
- PDF/TXT loader
src/ingestion.py - Chunking and IDs
src/chunking.py
Retrieval and ranking
- E5 embeddings
src/embeddings.py - Dense retriever
src/retrieval.py - Cross-encoder reranker
src/reranker.py - BM25 retrieval
src/bm25_retrieval.py - Retrieval evaluation
evaluations/evaluate.py
Answer generation
- RAG orchestrator
src/pipeline.py - Ollama generator
src/generation.py
Index persistence
- FAISS vector store
src/vector_store.py - Persisted index and documents
data/vector_store
Other components
- Learner
- Ollama service
Connections 19
- Learner → Streamlit app: uses
README.md - Streamlit app → PDF/TXT loader: ingests uploads
app.py - Streamlit app → Chunking and IDs: chunks documents
app.py - Streamlit app → RAG orchestrator: builds and queries
app.py - RAG orchestrator → E5 embeddings: embeds documents
README.md - RAG orchestrator → FAISS vector store: indexes and saves
src/pipeline.py - Streamlit app → FAISS vector store: loads index
app.py - FAISS vector store → Persisted index and documents: reads/writes
README.md - RAG orchestrator → Dense retriever: retrieves candidates
src/pipeline.py - Dense retriever → E5 embeddings: encodes query
src/retrieval.py - Dense retriever → FAISS vector store: searches vectors
src/retrieval.py - RAG orchestrator → Cross-encoder reranker: reranks candidates
src/pipeline.py - RAG orchestrator → Ollama generator: generates answer
README.md - Ollama generator → Ollama service: requests completion
README.md - RAG orchestrator → Streamlit app: returns citations
app.py - Retrieval evaluation → Dense retriever: evaluates dense search
evaluations/evaluate.py - Retrieval evaluation → BM25 retrieval: evaluates lexical search
evaluations/evaluate.py - Retrieval evaluation → Cross-encoder reranker: tests reranking
evaluations/evaluate.py - Retrieval evaluation → FAISS vector store: loads index
evaluations/evaluate.py