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!