How zalaavinash/rag-from-scratch-python works
RAG From Scratch is a local PDF question-answering application. The user invokes the CLI to ingest a PDF or ask a question; the pipeline coordinates extraction, chunking, embedding, persistent storage and retrieval, then generates an answer grounded in retrieved passages and returns source hits for display. Its main internal layer is the RAGPipeline orchestrator. The README documents the local Ollama and persistent ChromaDB design. Edges reflect the shown pipeline calls, CLI wiring and backend requests; unsampled implementation details are not inferred.
Main entry points: pipeline.py RAG pipeline · cli.py CLI commands · store.py Vector store wrapper · embedder.py Text embeddings
Components 10
User interface
- CLI commands
src/rag/cli.py
RAG processing
- RAG pipeline
src/rag/pipeline.py - PDF extraction
src/rag/loaders.py - Text chunking
src/rag/chunker.py
Local backends
- Text embeddings
src/rag/embedder.py - Answer generation
src/rag/llm.py
Vector persistence
- Vector store wrapper
src/rag/store.py - Persistent ChromaDB
Other components
- User
- Local Ollama
Connections 12
- User → CLI commands: runs commands
README.md - CLI commands → RAG pipeline: invokes ingest or ask
src/rag/cli.py - CLI commands → Vector store wrapper: configures persistence
src/rag/cli.py - RAG pipeline → PDF extraction: loads PDF
src/rag/pipeline.py - RAG pipeline → Text chunking: chunks text
src/rag/pipeline.py - RAG pipeline → Text embeddings: embeds chunks or question
src/rag/pipeline.py - RAG pipeline → Vector store wrapper: adds or searches vectors
src/rag/pipeline.py - RAG pipeline → Answer generation: requests completion
src/rag/pipeline.py - Text embeddings → Local Ollama: requests embeddings
src/rag/embedder.py - Answer generation → Local Ollama: requests chat
src/rag/llm.py - Vector store wrapper → Persistent ChromaDB: persists and queries
src/rag/store.py - RAG pipeline → CLI commands: returns answer and sources
src/rag/cli.py