How ryzen7-hermes-cpu/local-rag-knowledge-base works
Local RAG Knowledge Base collects documentation from repositories and web sources, indexes local Markdown/text content, and answers questions through retrieval-augmented chat. CLI and Streamlit are the user-facing entry points; both rely on RAGChatbot for initialization and question answering. The sampled implementation shows document loading and chunking, local embeddings with Chroma, and generation through Ollama. Downloader implementations are in one module; their individual source types are grouped. The README documents capabilities beyond the sampled code, so those are represented at the subsystem level.
Main entry points: rag_chat.py RAG chatbot · cli.py CLI commands · app.py Streamlit app · __init__.py Source downloaders
Components 17
User interfaces
- CLI commands
src/knowledge_base_app/cli.py - Streamlit app
app.py
Source acquisition
- Source downloaders
src/knowledge_base_app/downloaders/__init__.py - Local documents
Ingestion and index
- Document loader
src/knowledge_base_app/document_pipeline.py - Chunk preparation
src/knowledge_base_app/document_pipeline.py - Vector store
src/knowledge_base_app/vector_store.py - Chroma index
src/knowledge_base_app/vector_store.py
Retrieval and answers
- RAG chatbot
src/knowledge_base_app/rag_chat.py - Similarity search
src/knowledge_base_app/vector_store.py - Ollama client
src/knowledge_base_app/local_llm.py - Runtime settings
src/knowledge_base_app/config.py
Other components
- CLI user
- Web user
- GitHub and docs
- Sentence embeddings
- Ollama model
Connections 21
- CLI user → CLI commands: runs commands
- Web user → Streamlit app: asks questions
- CLI commands → Source downloaders: dispatches download
- Source downloaders → GitHub and docs: fetches or clones
- Source downloaders → Local documents: writes source files
- CLI commands → RAG chatbot: starts ingest or chat
- Streamlit app → RAG chatbot: initializes and asks
- RAG chatbot → Document loader: loads local documents
- Document loader → Local documents: reads files
- RAG chatbot → Chunk preparation: prepares documents
- RAG chatbot → Vector store: adds prepared documents
- Vector store → Sentence embeddings: encodes documents
- Vector store → Chroma index: stores vectors
- RAG chatbot → Similarity search: searches question
- Similarity search → Sentence embeddings: encodes query
- Similarity search → Chroma index: queries vectors
- RAG chatbot → Ollama client: generates answer
- Ollama client → Ollama model: sends prompt
- RAG chatbot → Runtime settings: reads configuration
- CLI commands → Runtime settings: reads defaults
- Streamlit app → Runtime settings: reads defaults