GitHub X (Twitter) LinkedIn
← All projects
Python & RAG

FastRAG

Ask questions about the FastAPI tutorial and get answers grounded in the docs themselves. Built from scratch, with no LangChain or LlamaIndex, so every step of the pipeline stays visible.

RoleDesign + Build StatusOpen source TypeRetrieval system
FastRAG retrieval pipeline illustration

Overview

Most RAG failures are retrieval failures, not generation failures. FastRAG is built around that insight: index the FastAPI docs once, then test retrieval on its own before ever asking an LLM to write an answer.

INDEXING (once) FastAPI docs --> chunker_v2.py --> chunks --> embedding model --> ChromaDB (rag_db/) QUERYING (every question) question --> embedding model --> closest chunks --> prompt --> AI writes the answer

Key features

  • No framework RAGChunking, embeddings, search and prompting wired by hand.
  • Docs aware chunkerKeeps code blocks whole, stamps the heading trail on every chunk, inlines referenced code.
  • Shared configOne model name / DB folder / collection, so indexing and search can never drift apart.
  • Retrieval evaleval.py + questions.json checks if the answer is inside the top chunks.
  • Keyword baselinerag_lite.py (stdlib only) gives a score to beat: 2/7 top 1, 3/7 top 3.
  • Local answersPaste the prompt anywhere, or answer via local Ollama.

How it works

  1. Clone the FastAPI docs and run index.py to chunk, embed and store them in ChromaDB.
  2. Run search.py "your question" to fetch the closest chunks and a prompt ready to paste.
  3. Run ask.py for the full loop, or eval.py to score retrieval in isolation.
python index.py # embed all chunks (run once) python search.py "How do I make a query parameter optional?" python eval.py python ask.py "How do I make a query parameter optional?"

Stack

Python 3.10+ sentence-transformers ChromaDB Ollama RAG

Have a project in mind?

Email me
Have a project? Let's talk