Summarize and collect into a DB a collection of LeetCode problems (Description, Solutions, Code, Analysis)
- My new e-book 📚 LLMs: An Intro and System Design (2023 Edition) will appear soon (by this Christmas 🎄, will be brought by Santa 🎅).
- It will cover the foundations of LLMs, LLMs System Design, and Latest Tools and Updates in Generative AI technology.
- Stay tuned! 🎁
This project harnesses the power of OpenAI's GPT models to summarize LeetCode problems, making interview preparation more efficient and engaging. Whether you're gearing up for a big interview or just brushing up on your coding skills, this tool is your go-to assistant!
- Summarizes LeetCode problems using OpenAI's GPT models.
- Efficient batch processing of problems.
- Easy-to-use command-line interface.
- Outputs stored neatly in CSV format.
-
Get OpenAI API Access:
- You'll need access to OpenAI's API. Check out OpenAI's Platform for subscription details and how to obtain API credits.
-
Clone the Repository:
git clone https://github.com/your-username/leetcode-summarizer.git
- Navigate to the repository directory:
cd leetcode-summarizer
-
Install Required Python Packages:
- Make sure you have Python installed on your system.
- Install necessary packages:
pip install requests pandas
-
Set Up Your API Key:
- Store your OpenAI API key as an environment variable for security.
- In your terminal, set the API key:
export OPENAI_API_KEY='your_api_key_here'
-
Running the Application:
- Run the main script:
python main.py
- Make sure you have your problem inputs ready in
prompt_arguments.csv
.
- Run the main script:
-
File Structure and Data Schemas:
logs/app.log
: Logs all runtime information, including progress updates and errors. Data schema: Timestamp, Log Level, Message.logs/prompts.log
: Stores detailed prompt templates used for each request. Data schema: Prompt Template, Problem.prompt_arguments.csv
: Input file containing LeetCode problem descriptions. Should have a header named "problem" followed by rows containing individual problem descriptions or titles.
- ChatGPT API Setup Challenges
- New API endpoint updates:
- The current endpoint used in this code is "https://api.openai.com/v1/chat/completions".
- This endpoint is one of the options for both "gpt-3.5-turbo" (default in this code) and "gpt-4" models.
- Each endpoint supports only a certain class of models.
- Explore the latest "endpoints" and their compatible models in Open AI's platform documentation.
- New format for request message (currently ChatML format).
- You have to upgrade to a paid account and add credits to your account:
- There’s a known bug with the payment system. You may get the
Error 429 Too Many Requests
from Open AI Api while adding your payment method. You may need to install a VPN (as I did as the last solution) to get around this issue (Link), or wait for it to be resolved, hopefully soon!
- There’s a known bug with the payment system. You may get the
- You need to re-generate your Open AI key after upgrading the billing account and store the new API key in your bash_profile for use in the python code. Otherwise, you will get the error
404 Client Error: Not Found for url: https://api.openai.com/v1/completions
.
- New API endpoint updates:
- Suggestion is using Visual Studio Code for an enhanced coding experience with this project.
- 🎧: This README and the accompanying code were crafted while listening to some energetic techno beats! 🎶 Techno is love ❤️.
- Check out some of my DJ mixes (Organic House, Melodic House and Techno) here on Soundcloud!
- 🎧🎵 My current favorite track: Simulation by "Anyma & Chris Avantgarde".
- This project was created with assistance from my ChatGPT assistant, who was indispensable in writing the code and crafting this README.
- 🙏 I am deeply grateful for being where I am today and for the opportunity to share this work with you all. 🌍 It's been a long, challenging journey filled with excitement from the start to this point. I am thankful for all the gifts that the universe has brought to me, and I've discovered that living with gratitude is a profoundly transformative way of life. 🌈
To speak gratitude is courteous and pleasant, to enact gratitude is generous and noble, but to live gratitude is to touch Heaven. – Johannes A. Gaertner (German Art Historian, Professor of Art History)
-
🙏 Special thanks go to my very close friends who have always supported me throughout my journey.
-
🙏 I am also eternally grateful to all my teachers who have guided me from the very beginning until now. Their wisdom and support have been invaluable.