DocsStation
AI Projects

YouTube RAG Chatbot Project

By csestudy247 Updated December 2, 2026 3 min read
3 min read

YouTube RAG Chatbot is an AI-powered web application that lets you have a conversation with any YouTube video. Instead of watching a 1-hour video to find one answer, you paste the URL, and the chatbot answers your questions instantly — using only the content from that video.

It uses a technique called Retrieval-Augmented Generation (RAG), which combines:

  • Document retrieval — finding the most relevant parts of the transcript
  • LLM generation — using Gemini AI to generate accurate, context-aware answers

Problem It Solves

ProblemSolution
Videos are long and hard to searchInstantly answer specific questions from any video
No way to “ctrl+F” a YouTube videoSemantic search over the full transcript
AI might hallucinate factsRAG anchors answers only to the video transcript
Requires watching the whole videoChat interface extracts what you need in seconds

Real-world use cases:

  • 📚 Students summarizing lecture videos
  • 🔬 Researchers extracting key findings from conference talks
  • 💼 Professionals reviewing long webinars or podcasts
  • 🎓 Quick revision before exams from educational YouTube content

YouTube RAG Chatbot

Tech Stack

LayerTechnologyPurpose
UIStreamlitWeb interface with dark theme
OrchestrationLangChainRAG pipeline & chain management
LLMGoogle Gemini 2.5 FlashAnswer generation
EmbeddingsGoogle Gemini EmbeddingConvert text to vectors
Vector StoreFAISSFast similarity search
Transcriptyoutube-transcript-apiFetch YouTube subtitles
Text SplittingLangChain RecursiveCharacterTextSplitterChunk transcript into pieces
Environmentpython-dotenvSecure API key management

Setup Guide (For Students)

Prerequisites

  • Python 3.10 or higher installed
  • A Google AI Studio API key (free at aistudio.google.com)
  • Git installed

Step 1 — Clone the Repository

git clone https://github.com/sanjit507/Youtube-RAG-Chatbot.git
cd Youtube-RAG-Chatbot

Step 2 — Create a Virtual Environment

Windows:

python -m venv venv
venvScriptsactivate

macOS / Linux:

python3 -m venv venv
source venv/bin/activate

You should see (venv) appear at the start of your terminal line.


Step 3 — Install Dependencies

pip install -r requirements.txt

⚠️ This may take 2–3 minutes. FAISS and LangChain have several sub-dependencies.


Step 4 — Set Up Your API Key

Create a file called .env in the project root:

# Windows
echo GOOGLE_API_KEY=your_api_key_here > .env

# macOS/Linux
echo "GOOGLE_API_KEY=your_api_key_here" > .env

Or create it manually — create a new file named .env and add:

GOOGLE_API_KEY=AIzaSy...your_key_here

🔑 Get your free API key at aistudio.google.com/app/apikey


Step 5 — Run the App

streamlit run app.py

The app will open at http://localhost:8501 in your browser.


Step 6 — Use the App

  1. Paste any YouTube URL in the input box
    e.g. https://www.youtube.com/watch?v=LPZh9BOjkQs
  2. Click 🚀 Load and wait ~10-30 seconds for indexing
  3. Type your question and click 💬 Ask
  4. Get AI-powered answers based only on the video content!

Example Questions to Try

Use this video: https://www.youtube.com/watch?v=LPZh9BOjkQs (3Blue1Brown — How LLMs work)

QuestionExpected Answer Type
What is a large language model?Definition from the video
How does training work?Step-by-step explanation
What is backpropagation?Concept from the video
Summarize this videoFull summary
What is the transformer architecture?Technical explanation
Scroll to Top