This CLI tool is a TypeScript application that leverages the OpenAI API, HNSWLib, and Langchain to analyze YouTube videos and engage in an AI-driven conversation based on the video's content. Aimed at TypeScript engineers, this README provides an exhaustive guide for understanding, installing, and using this tool.
- Prompt for YouTube URL: Asks the user for a YouTube video URL with a default option.
- Transcript Download: Downloads the transcript of the given YouTube video and splits it into documents.
- OpenAI Embeddings: Utilizes OpenAI embeddings to create vector embeddings for the downloaded documents.
- Local Vector Store: Utilizes the HNSWLib library to store embeddings in a local vector store on the filesystem.
- AI-Driven Chat: Uses the Langchain library to build a chat interface that uses the embeddings as context.
- Summary Display: Evaluates and displays a summary of the video based on its transcripts.
- Interactive Q&A: Allows the user to ask follow-up questions, which are answered using the embeddings until the user types "exit".
To install the CLI tool, you need to have Node.js and npm installed on your system. Then run:
# Clone the repository
git clone https://github.com/djheru/gpt-cli.git
# Navigate into the directory
cd gpt-cli
# Install dependencies
npm install
To execute the application, run:
npm run youtube
Follow the on-screen prompts to input a YouTube URL (or use the default) and engage in a conversation based on the video's content.
Here are the main libraries and their roles in this project as per package.json
:
openai
: For generating embeddings and AI-related functionalities.hnswlib
: Used for efficient similarity search and storage of embeddings.langchain
: For building the chat interface.
index.ts
: Entry point for the application.youtube.ts
: Contains the logic for handling YouTube video analysis and chat.utils.ts
: Utility functions used across the project.
// File: index.ts
// Entry point for the CLI application
// File: youtube.ts
// Main logic for YouTube video analysis and chat functionality
// File: utils.ts
// Contains utility functions for embedding creation, summary, etc.
If you're interested in contributing, please follow the standard fork, feature-branch, pull request workflow.
- Fork the repository.
- Create a new feature branch.
- Make your changes.
- Create a pull request.
This project is licensed under the MIT License.
This README aims to be a thorough guide for TypeScript engineers looking to understand and contribute to this tool. Feel free to submit issues or pull requests to improve it.