YouTube Chat — A Complete RAG System
Today we build a real working RAG application — a chatbot that answers questions about any YouTube video. This project uses every concept from Days 1 through 13, assembled into one working pipeline in LangChain.
Fetch the YouTube Transcript
Use the YouTube Transcript API to fetch the video's transcript. The raw output is a list of timestamped text segments — join them into one continuous string.
Split the Transcript into Chunks
Use RecursiveCharacterTextSplitter with chunk_size=1000 and chunk_overlap=200 as a starting point. A 2-hour video typically produces 150–200 chunks.
Create the Vector Store
Use OpenAI Embeddings and FAISS for local development. FAISS.from_documents() embeds every chunk and stores the results in one call.
Build the RAG Chain
Create a retriever, design a prompt template, connect the LLM, and wire everything together. One invoke call runs the entire pipeline.
You have built a complete RAG system — from YouTube transcript to working chatbot. Load, Split, Embed, Store, Retrieve, Augment, Generate — the full pipeline in approximately 30 lines of LangChain code. Try it with different videos and experiment with chunk sizes and prompts to see the difference each makes.