All projects
FreeIntermediate 60 min pytest -q → 5 passed

Docs Bot: real RAG with citations

Chunk, index, retrieve and answer with sources — no API key needed.

A dependency-free retrieval-augmented generation pipeline you can read in one sitting. It chunks documents, builds deterministic embeddings, ranks passages with a hybrid of exact terms and cosine similarity, and answers with citations or an honest "I don't know".

README

# Docs Bot — a real RAG project you can finish in an evening

A dependency-free retrieval-augmented generation pipeline. It chunks your documents, indexes them, retrieves the best passages and answers with citations. No API key, no vector database, no magic.

## Run it

python3 run_demo.py
python3 -m pytest -q     # 5 passed

## How it works

  1. chunk() splits documents into overlapping word windows.
  2. embed() turns text into a deterministic 256-dimension vector (hashed bag of words).
  3. search() ranks chunks with a hybrid of exact-term overlap and cosine similarity.
  4. answer() returns the best passage and its source, or "I don't know" when nothing is relevant.

## Make it production-grade (the course lessons show how)

  • Replace embed() with a real embedding model (OpenAI, Cohere, Voyage, sentence-transformers).
  • Store vectors in pgvector/Supabase, Qdrant or Pinecone instead of a Python list.
  • Add hybrid search with BM25 + a reranker.
  • Add 30+ eval questions and measure recall@k before changing the prompt.
  • Pass the retrieved chunks to an LLM and require it to cite the source IDs.

MIT licensed.

Files in this download

data/handbook.md

rag.py

README.md

requirements.txt

run_demo.py

tests/test_rag.py

Push this project to GitHub

Create a repository and upload every file as one commit. Use it for your portfolio, a code review, or your first deploy.

Classic token: tick `repo`. Fine-grained token: give this repository Contents → Read and write and Metadata → Read. Create a token · Fine-grained token

Your token is stored in this tab's sessionStorage and sent only to api.github.com. keepUp AI never receives it.

No GitHub account? The project ZIP works on its own — push later whenever you like.

All projects

Generated from the same content the course teaches. If a lesson changes, its download and tests change with it.