Runnable retrieval-augmented generation (RAG) demos that accompany the AI engineering series on snehalagrawal.com. Each demo is self-contained and runs locally: no API keys or paid services. 01, 03, 04, 05, and 06 run in Python and JavaScript with Ollama; 02 fine-tunes a model, so it is Python only and needs a Mac with Apple silicon (MLX).

Demo Article What it shows
01-basic-rag RAG Explained: How AI Systems Work With Your Data Retrieval versus sending the whole knowledge base, on the same questions: what fits, what it costs, and what still breaks
02-rag-vs-fine-tuning RAG vs Fine-Tuning: When Should You Use Which? A real LoRA fine-tune against retrieval on the same model: what each one teaches, and what happens when a fact changes (Python, Apple silicon)
03-production-rag-pipeline Designing a Production-Ready RAG Pipeline The 01 assistant with a pipeline around it: a versioned, incremental index; one deadline per request; a relevance gate; fault injection; and a trace for every request
04-chunking Chunking Strategies for RAG: What Actually Matters? Ten ways to split five long documents, compared on whether the answering passage is retrieved at equal token budgets, plus a hand-graded answer stage
05-hybrid-search Retrieval Strategies: Vector Search, Keyword Search, and Hybrid Search Vector, BM25, and two hybrids ranking the same chunks within the same budget: what each finds that the others miss
06-reranking Reranking: Improving Retrieval Quality A second stage that reads the question and each candidate together: candidate recall, what reranking fixes and breaks, and what it costs

Linting

The repository has one lint setup for every demo: Ruff for Python and ESLint for JavaScript.

npm install                              # ESLint (repository root)
pip install -r requirements-dev.txt      # Ruff
npm run lint                             # both

Conventions

  • Every demo has a README with the exact setup that produced the numbers in its article.
  • Generated files (data/index.json, results-*.jsonl) and .env files are not committed.

From the repository's README on GitHub, synced Nov 15, 2026.

← All work