How ennaguiyoussef/simple_rag works
This is a learning-focused cat-facts RAG chatbot. A user submits a question in the React chat UI; the Flask endpoint validates it, retrieves relevant facts from an in-memory vector database, asks Ollama to generate a grounded answer, and returns it to the UI. The README also describes embedding, similarity search, and a health endpoint. The sampled Flask source implements RAG directly; although rag_core.py is documented as core logic, the sampled app.py does not import it, so no connection between them is shown.
Main entry points: app.py Flask API · chatbot.jsx Chat UI · App.jsx React app · cat-facts Cat facts
Components 13
Flask API
- Flask API
app.py - Chat endpoint
app.py - Health endpoint
app.py
RAG pipeline
- RAG answer flow
app.py - Cat facts
cat-facts - In-memory vectors
app.py - Similarity retrieval
app.py
Ollama models
- Embedding model
- Language model
Other components
- Chat user
- Health-check caller
Connections 16
- Chat user → Chat UI: asks
- Chat UI → Flask API: POST /chat
- Flask API → Chat endpoint: dispatches
- Chat endpoint → RAG answer flow: calls
- RAG answer flow → Similarity retrieval: calls
- Similarity retrieval → Embedding model: embeds query
- Similarity retrieval → In-memory vectors: reads vectors
- RAG answer flow → Language model: sends context
- Cat facts → Embedding model: embeds facts
- Flask API → Cat facts: loads at startup
- Flask API → In-memory vectors: stores embeddings
- Chat endpoint → Chat UI: returns answer
- Chat user → React app: opens
- React app → Chat UI: renders
- Health-check caller → Flask API: GET /health
- Flask API → Health endpoint: dispatches