How b1a-z3/rag_chatbot works
This is a local documentation RAG assistant. Documents are loaded and chunked, embedded into a persistent Chroma index, then user questions retrieve relevant chunks for a locally hosted Ollama model; the Streamlit UI presents answers, citations, and per-query metrics. The graph also shows the README-documented ingestion stages and evaluation capability. Evaluation is ancillary to the user workflow. Source excerpts support the shown calls; the underlying Chroma and Ollama services are external dependencies.
Main entry points: rag.py Answer orchestrator · evaluate.py Retrieval and answer evaluator · ingest.py Document loader · app.py Streamlit chat
Components 14
Document indexing
- Document loader
src/ingest.py - Text chunker
src/ingest.py - Embed and index
src/ingest.py - Persistent vector store
chroma_db
Question answering
- Answer orchestrator
src/rag.py - Chunk retrieval
src/rag.py - Context prompt
src/rag.py - Answer citations and metrics
src/rag.py
User interface
- Streamlit chat
src/app.py
Quality evaluation
- Hand-labeled Q&A
eval/qa_testset.json - Retrieval and answer evaluator
eval/evaluate.py
Other components
- Documentation user
- PDF / Markdown docs
- Ollama LLM
Connections 14
- PDF / Markdown docs → Document loader: loads
src/ingest.py - Document loader → Text chunker: chunks text
src/ingest.py - Text chunker → Embed and index: embeds chunks
src/ingest.py - Embed and index → Persistent vector store: writes index
src/ingest.py - Documentation user → Streamlit chat: asks question
src/app.py - Streamlit chat → Answer orchestrator: calls
src/app.py - Answer orchestrator → Chunk retrieval: retrieves chunks
src/rag.py - Chunk retrieval → Persistent vector store: queries
src/rag.py - Answer orchestrator → Context prompt: builds context
src/rag.py - Answer orchestrator → Ollama LLM: generates answer
src/rag.py - Answer orchestrator → Answer citations and metrics: returns citations and metrics
src/rag.py - Answer orchestrator → Chunk retrieval: retrieves for evaluation
eval/evaluate.py - Retrieval and answer evaluator → Hand-labeled Q&A: loads cases
eval/evaluate.py - Retrieval and answer evaluator → Answer orchestrator: evaluates answers
eval/evaluate.py