An intelligent multilingual chatbot that enables natural conversations with YouTube videos in 50+ languages using RAG (Retrieval Augmented Generation).
- Overview
- Project Structure
- Features
- Demo
- Architecture
- Tech Stack
- Prerequisites
- Installation
- Configuration
- Usage
- Deployment
- Contributing
- License
- Acknowledgments
YouTube Transcript Chatbot is an AI-powered application that allows users to have natural language conversations with YouTube videos. The system extracts video transcripts, processes them using advanced NLP techniques, and enables semantic search and question-answering in multiple languages.
youtube-chatbot/
├── app.py # Main application file
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
│
├── docker/
│ ├── Dockerfile # Docker container configuration
│ └── .dockerignore # Docker ignore rules
└── README.md # Readme file
- 🌍 Multilingual Support: Works seamlessly with videos in English, Hindi, Urdu, Arabic, Spanish, and 50+ other languages
- 🚀 No Translation Required: Uses original transcripts for maximum accuracy and preserves cultural context
- 💬 Natural Conversations: Powered by state-of-the-art LLMs from OpenRouter
- 🎯 Smart Retrieval: Employs RAG with vector embeddings for precise context retrieval
- ⚡ Fast & Efficient: Cloud-based embeddings with no local model downloads
- 📺 YouTube Integration: Automatic transcript extraction from any YouTube video
- 🔍 Semantic Search: Intelligent context retrieval using vector similarity
- 💡 Conversational AI: Natural dialogue with multiple LLM options
- 🌐 Cross-lingual Queries: Ask questions in any language, get relevant answers
- 🎯 RAG Architecture: Retrieval Augmented Generation for accurate responses
- 🔄 Streaming Responses: Real-time token streaming for better UX
- 🔁 Automatic Retry Logic: Handles API rate limits and timeouts gracefully
- 📊 Vector Database: Persistent storage with Qdrant Cloud
- 🧠 Multiple LLM Support: Choose from Mistral & LLaMA
# Quick start
streamlit run app.py┌─────────────────────┐
│ Youtube Video URL │
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Transcript Extractor│
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Text Splitter │ (600 char chunks)
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ HuggingFace API │ (Multilingual Embeddings)
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ Qdrant Vector DB │
└────────┬────────────┘
│
▼
User Query
│
▼
┌─────────────────────┐
│ Semantic Search │ (MMR Retrieval)
└────────┬────────────┘
│
▼
┌─────────────────────┐
│ OpenRouter LLM │ (Generate Response)
└────────┬────────────┘
│
▼
Streamed Answer
- Streamlit - Interactive web application framework
- LangChain - LLM orchestration framework
- OpenRouter - Unified LLM API gateway
- HuggingFace - Multilingual embeddings API
- Qdrant - Vector database for Maximal Marginal Relevance Retrieval (MMR)
- youtube-transcript-api - YouTube transcript extraction
- sentence-transformers - Multilingual embeddings model
- langchain-openai - OpenRouter integration
- langchain-qdrant - Qdrant vector store integration
- Python 3.10 or higher
- pip or conda package manager
- API keys (see Configuration Options)
# Clone the repository
git clone https://github.com/yourusername/youtube-chatbot.git
cd youtube-chatbot
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.example .env
# Edit .env with your API keys
# Run the application
streamlit run app.py# Build the image
docker build -t youtube-chatbot .
# Run the container
docker run -d \
--name yt-chatbot \
-p 8501:8501 \
--env-file .env \
youtube-chatbotCreate a .env file in the root directory:
# OpenRouter API Key (for LLM generation)
OPENROUTER_API_KEY=sk-or-v1-xxxxx
# Qdrant Cloud Configuration
QDRANT_URL=https://xxxxx.qdrant.io
QDRANT_API_KEY=xxxxx
# HuggingFace API Key (for embeddings)
HUGGINGFACE_API_KEY=hf_xxxxx| Variable | Description | Required |
|---|---|---|
OPENROUTER_API_KEY |
API key for LLM access | ✅ Yes |
QDRANT_URL |
Qdrant cluster URL | ✅ Yes |
QDRANT_API_KEY |
Qdrant authentication key | ✅ Yes |
HUGGINGFACE_API_KEY |
HuggingFace API token | ✅ Yes |
-
Start the Application
streamlit run app.py
-
Ingest a Video
- Paste a YouTube URL in the sidebar
- Click "📥 Ingest Transcript"
- Wait for processing (10-30 seconds)
-
Start Chatting
- Type your question in the chat input
- Receive AI-generated answers based on video content
- Continue the conversation naturally
The chatbot supports transcripts in:
- 🇬🇧 English
- 🇮🇳 Hindi
- 🇵🇰 Urdu
- 🇸🇦 Arabic
- 🇪🇸 Spanish
- 🇫🇷 French
- 🇩🇪 German
- 🇯🇵 Japanese
- 🇰🇷 Korean
- 🇨🇳 Chinese
- And 50+ more languages!
Choose from multiple AI models:
| Model | Provider | Strengths |
|---|---|---|
| LLaMA 3.2 3B | Meta | Fast, efficient |
| Mistral Small | Mistral AI | Balanced performance |
Contributions are welcome! Here's how you can help:
- 🐛 Report Bugs: Open an issue describing the problem
- 💡 Suggest Features: Share your ideas for improvements
- 📝 Improve Documentation: Help make docs clearer
- 🔧 Submit Pull Requests: Fix bugs or add features
# Fork and clone the repository
git clone https://github.com/yourusername/youtube-chatbot.git
# Create a feature branch
git checkout -b feature/amazing-feature
# Make your changes and commit
git commit -m "Add amazing feature"
# Push to your fork
git push origin feature/amazing-feature
# Open a Pull RequestThis project is licensed under the MIT License.
- Streamlit - For the amazing web framework
- LangChain - For LLM orchestration
- OpenRouter - For unified Multiple LLM access
- Qdrant - For vector database
- HuggingFace - For embeddings API
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: muhammadtalhasheikh50@gmail.com
Built with ❤️ by Muhammad Talha
⭐ Star this repo if you find it helpful!