The capstone: a RAG (retrieval-augmented generation) chatbot that answers questions from your own documents. This is the architecture behind modern AI assistants over private data, and it ties together files, APIs, data structures and everything else in the track.
The RAG pipeline
- Ingest — split your documents into overlapping chunks.
- Embed & store — turn each chunk into an embedding vector and keep them in a vector store.
- Retrieve — embed the user's question and find the most similar chunks.
- Generate — pass those chunks plus the question to an LLM for a grounded answer.
The core loop
# 1. Ingest: chunk your documentschunks = chunk_documents(load_docs("docs/"))# 2. Embed & store (embeddings from an API or local model)store = VectorStore()for chunk in chunks:store.add(chunk, embed(chunk))# 3 & 4. Retrieve then generatedef answer(question: str) -> str:hits = store.search(embed(question), k=4) # nearest chunkscontext = "\n\n".join(h.text for h in hits)prompt = f"Answer using ONLY this context:\n{context}\n\nQ: {question}"return call_llm(prompt)
Stretch goals
Cite which chunks an answer came from, add conversational memory, or swap the vector store for a dedicated one (FAISS, Chroma). Congratulations — this completes the Python track.
Key takeaways
- 01RAG retrieves relevant context, then has an LLM generate a grounded answer.
- 02Pipeline: ingest → embed → store → retrieve → generate.
- 03Embeddings place similar meanings near each other for similarity search.
- 04It reduces hallucination and answers over private/current data.
- 05Integrates the whole track: files, APIs, data structures and more.
