This project features a chatbot designed to fetch YouTube transcripts and generate responses based on video content using OpenAI compatable API. It comprises two primary components: Embedding/Querying the transcript, Generating response based on relevant context.
- Implement a user interface for
main.py
to improve the user experience and make it more interactive. - Update chat interface to enhance user interface and allow for multiple chats.
pip install -r requirements.txt
- Use with Chrome extension on youtube page itself.
- CLI chat with
main.py
. - Use web UI
ui.py
.
The Chrome extension provides a user interface for interacting with the chatbot.
- Open Google Chrome and go to
chrome://extensions/
. - Enable "Developer mode" by toggling the switch in the top-right corner.
- Click "Load unpacked" and select the directory containing the extension files (
icon.png
,manifest.json
,popup.html
,popup.js
,popup.css
, andserver.py
).
The Flask server is responsible for handling YouTube transcripts, embedding them with Google's Generative AI Embeddings, and retrieving relevant parts based on user queries using Chroma vector store. The server is accessible at http://127.0.0.1:5000
.
To set up the Flask server:
python server.py
- Run the Flask server using the provided instructions.
- Navigate to a YouTube video.
- Click the extension icon in the Chrome toolbar.
- Input your message in the provided field and press Enter or click the send button.
- The chatbot will fetch the relevant part of the transcript and generate a response based on your message.
The main.py
script provides a command-line interface for chatting with YouTube videos. It uses the same functionality as the Flask server and Chrome extension but runs in a standalone environment. No Flask server or Chrome extension is required.
The web interface offers an interactive way to engage with the YouTube Chatbot. Follow these steps:
- Run (
python ui.py
). - Open your web browser and navigate to http://127.0.0.1:5000.
- Enter a YouTube video URL.
- Type your message in the provided input field and press Enter or click the send button.
- The chatbot will fetch the relevant part of the transcript and generate a response based on your message.
- Replace
YOUR_API_KEY
inmain.py
with your actual API key. - The Chrome extension uses the Naga.ai API for generating responses. Adjust the API key and URL in
popup.js
based on your setup. - This project is OpenAI-compatible, allowing you to use various language models and embeddings (refer to Langchain docs).