An AI-powered chat system that allows users to interact with YouTube video content through natural language queries. Built using LangChain and Google's Gemini model.
- Extract transcripts from YouTube videos
- Process and chunk video transcripts
- Generate embeddings using Google's Gemini model
- Create semantic search capabilities using FAISS vector store
- Interactive Q&A with video content
- Multi-query retrieval for better context understanding
- Python 3.8+
- Google API Key (for Gemini model)
- Virtual Environment (recommended)
- Clone the repository:
git clone <repository-url>
cd TalkingYoutube- Create and activate a virtual environment:
python -m venv venv
# On Windows
.\venv\Scripts\activate
# On Unix or MacOS
source venv/bin/activate- Install required packages:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your Google API key:
GOOGLE_API_KEY=your_api_key_here
TalkingYoutube/
├── assistant/
│ └── prompt.py # AI assistant prompt templates
├── indexing/
│ ├── document_load.py # YouTube transcript fetching
│ ├── embedder.py # Document embedding generation
│ └── splitter.py # Text splitting utilities
├── utils/
│ ├── formatter.py # Context formatting
│ └── parser.py # Output parsing
├── .env # Environment variables
├── main.py # Main application
└── requirements.txt # Project dependencies
- Run the main script with a YouTube video ID:
python main.py- The system will:
- Fetch the video transcript
- Split it into manageable chunks
- Generate embeddings
- Create a vector store
- Allow you to ask questions about the video content
question = "What is vectorization?"
answer = ask.invoke(question)
print(answer)- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
- LangChain for the framework
- Google's Gemini model for embeddings and chat
- FAISS for vector storage
- YouTube Transcript API for caption extraction