How zabdeilmercado/mini-rag works
Mini-RAG ingests UTF-8 text, chunks it, creates local Ollama embeddings, and stores a reusable disk cache or PostgreSQL records. Users then select a source, embed a question, retrieve the top passages through NumPy or pgvector, and generate an answer with Ollama. The CLI and browser interface enter through different orchestrators; the browser also supports upload and passage inspection. Edges reflect shown calls, imports, and browser requests; README-documented capabilities supplement the excerpts, while unsampled implementation details are not inferred.
Main entry points: workflows.py Workflow coordinator · web_server.py Local HTTP server · main.py CLI entry · postgres_store.py Postgres store and search
Components 15
User interfaces
- CLI entry
main.py - Browser UI
web/app.js - Local HTTP server
web_server.py
Workflow coordination
- Workflow coordinator
workflows.py - Shared settings
config.py
Document ingestion
- Read and chunk text
ingest.py - Document embeddings
ingest.py
Retrieval and answers
- Question embedding and NumPy ranking
retrieve.py - Context answer generation
generate.py
Persistence
- Disk cache
storage.py - Postgres store and search
postgres_store.py
Other components
- CLI user
- Browser user
- Ollama service
- PostgreSQL with pgvector
Connections 22
- CLI user → CLI entry: runs commands
README.md - CLI entry → Workflow coordinator: prepares ingestion or search
main.py - CLI entry → Context answer generation: requests answer
main.py - Browser user → Browser UI: uploads and asks
README.md - Browser UI → Local HTTP server: requests API
web/app.js - Local HTTP server → Browser UI: serves assets
web_server.py - Local HTTP server → Workflow coordinator: ingests or prepares search
web_server.py - Local HTTP server → Postgres store and search: lists sources
web_server.py - Local HTTP server → Context answer generation: generates answer
web_server.py - Workflow coordinator → Read and chunk text: loads and chunks
workflows.py - Workflow coordinator → Document embeddings: creates embeddings
workflows.py - Workflow coordinator → Disk cache: loads or saves cache
workflows.py - Workflow coordinator → Postgres store and search: stores or finds source
workflows.py - Workflow coordinator → Question embedding and NumPy ranking: builds NumPy search
workflows.py - Read and chunk text → Document embeddings: provides chunks
workflows.py - Document embeddings → Ollama service: requests embeddings
ingest.py - Question embedding and NumPy ranking → Ollama service: embeds question
retrieve.py - Question embedding and NumPy ranking → Postgres store and search: not used
- Postgres store and search → PostgreSQL with pgvector: reads and writes
postgres_store.py - Local HTTP server → Workflow coordinator: retrieves passages
web_server.py - CLI entry → Workflow coordinator: searches stored source
main.py - Context answer generation → Ollama service: requests chat
generate.py