Skip to content

maw-khan/youtube-rag-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Advanced YouTube RAG Chatbot

Python Streamlit LangChain Google Gemini FAISS License


Deployed App Link: https://chatwithvideos.streamlit.app/


πŸ“Œ Project Overview

This application allows users to interact conversationally with YouTube videos.

The system extracts video transcripts, converts them into semantic embeddings, stores them in a FAISS vector database, retrieves relevant transcript chunks, reranks results semantically, and generates contextual answers using Gemini AI.

The project demonstrates:

  • RAG pipeline engineering
  • NLP workflows
  • conversational memory
  • semantic retrieval
  • vector databases
  • production AI application architecture

Homepage


πŸš€ Live Features

βœ… YouTube transcript extraction
βœ… Conversational AI chatbot
βœ… Multi-video support
βœ… Semantic search with FAISS
βœ… Gemini-powered responses
βœ… Semantic reranking
βœ… Timestamp citations
βœ… Transcript download
βœ… Streaming responses
βœ… Video thumbnail preview
βœ… Persistent vector database
βœ… Production-style modular architecture


System Architecture

Architecture


βš™οΈ Tech Stack

Frontend

  • Streamlit

AI / NLP

  • LangChain
  • Google Gemini AI
  • Sentence Transformers

Vector Database

  • FAISS

Data Processing

  • YouTube Transcript API
  • Recursive Text Chunking

πŸ“‚ Project Structure

youtube-rag-chatbot/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .env
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ transcript.py
β”‚   β”œβ”€β”€ chunking.py
β”‚   β”œβ”€β”€ embeddings.py
β”‚   β”œβ”€β”€ vectorstore.py
β”‚   β”œβ”€β”€ rag_chain.py
β”‚   β”œβ”€β”€ reranker.py
β”‚
β”œβ”€β”€ data/
β”‚   └── faiss_index/
β”‚
└── images/
    └── screenshots/

πŸš€ Installation

Clone Repository

git clone github.com/maw-khan/youtube-rag-chatbot.git

Install Dependencies

pip install -r requirements.txt

Run Application

streamlit run app.py

πŸ”‘ API Key Setup You need a Google Gemini API Key. Get it from: πŸ‘‰ https://ai.google.dev/ No need for .env file β€” the app accepts it directly via Streamlit sidebar.

API Required


▢️ Run the Deployed App (Link):

https://chatwithvideos.streamlit.app/


πŸ’‘ How to Use

  1. Enter your Gemini API Key in the sidebar
  2. Paste youtube videos links/URL
  3. Click β€œProcess Video”
  4. Wait for processing to complete
  5. Start asking questions in the chat box
  6. View answers + expandable source references

πŸ“š Example Query β€œWhat is the main conclusion of the video?” The chatbot will:

  • Retrieve relevant chunks
  • Generate an answer using Gemini
  • Show source excerpts used for reasoning

Chat Example


Chat Example


πŸ”₯ Key Features Explained

πŸŽ₯ Transcript Extraction

Automatically extracts transcripts from YouTube videos.

πŸ“Š Retrieval-Augmented Generation (RAG)

Relevant transcript chunks are retrieved before generating responses.

πŸ“š Semantic Reranking

Retrieved chunks are reranked using transformer-based semantic similarity models.

πŸ“Œ Timestamp Citations

Responses include transcript timestamps for source verification.

⚑ Streaming Responses

Answers stream in real time for better conversational UX.

πŸ“₯ Transcript Download

Users can download processed transcripts directly.


πŸš€ Future Improvements

  • YouTube playlist support
  • Multi-user authentication
  • Chat export
  • PDF summary generation
  • Voice interaction
  • Hybrid BM25 + vector retrieval
  • LangGraph agent workflows

πŸ“Œ Learning Outcomes

This project helped strengthen understanding of:

  • AI application engineering
  • RAG pipelines
  • vector search systems
  • semantic retrieval
  • conversational memory
  • Streamlit deployment
  • modular software architecture

πŸ‘¨β€πŸ’» Author

Muhammad Ali Waris Khan

AI Developer | RAG Systems | Streamlit AI Apps | Python

About

This repo builds a rag chatbot for youtube videos. User provides a YouTube URL. The system extracts transcript, chunks transcript, creates embeddings, stores vectors and enables conversational Q&A with memory

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages