How devfullcycle/mba-ia-rag works
RAG Knowledge Chat ingests Markdown knowledge documents, indexes chunks in Postgres/pgvector, and answers user questions through a shared retrieval-augmented pipeline. The documented query flow is planning (including clarification), filtered retrieval, optional reranking, answer generation, and application-built sources; users can enter through terminal chat or the HTTP API. Incremental indexing tracks document hashes and chunk IDs in a manifest. The README documents observability for pipeline runs. Some internal calls are not shown in the excerpts, so those stage links cite the README rather than implying additional source-level wiring.
Main entry points: rag_pipeline.py RAG pipeline · index.py Incremental indexer · retrieve.py Filtered retrieval · ingest.py Document chunking
Components 17
Ingestion and indexing
- Markdown knowledge base
knowledge_base - Document chunking
app/ingest.py - Chunk JSONL
app/ingest.py - Incremental indexer
app/index.py - Index manifest
app/manifest.py
Question answering
- RAG pipeline
app/rag_pipeline.py - Query planner
app/query_planner.py - Filtered retrieval
app/retrieve.py - Chunk reranker
app/rerank.py - Answer and sources
app/rag_pipeline.py
User interfaces
- Terminal chat
app/rag_chat.py - HTTP API
app/api.py
Runtime infrastructure
- Postgres pgvector
- OpenAI models
- Settings
app/config.py - Database access
app/db.py
Other components
- User
Connections 22
- User → Terminal chat: asks
README.md - User → HTTP API: posts question
README.md - Terminal chat → RAG pipeline: runs
app/rag_chat.py - HTTP API → RAG pipeline: runs
README.md - Markdown knowledge base → Document chunking: reads
app/ingest.py - Document chunking → Chunk JSONL: writes
app/ingest.py - Chunk JSONL → Incremental indexer: loads
app/index.py - Incremental indexer → Index manifest: reads and writes
app/index.py - Incremental indexer → Postgres pgvector: indexes chunks
app/index.py - Incremental indexer → OpenAI models: embeds chunks
README.md - RAG pipeline → Query planner: plans query
README.md - RAG pipeline → Filtered retrieval: retrieves chunks
README.md - RAG pipeline → Chunk reranker: reranks chunks
README.md - RAG pipeline → Answer and sources: generates answer
README.md - Query planner → OpenAI models: plans with model
README.md - Filtered retrieval → Postgres pgvector: searches
app/retrieve.py - Filtered retrieval → OpenAI models: embeds query
app/retrieve.py - Chunk reranker → OpenAI models: selects chunks
README.md - Answer and sources → OpenAI models: generates answer
README.md - RAG pipeline → Postgres pgvector: connects store
app/rag_pipeline.py - Database access → Postgres pgvector: connects
app/db.py - Settings → Database access: configures
app/db.py