A tool to summarize books of any size into a couple of paragraphs.
You need to create a virtual env and install the packages listed in requirements.txt
. You can then run Jupyter Notebooks in VS Code.
Follow these steps: How to Work with Python Virtual Environments, Jupyter Notebooks and VS Code.
You need to create a .env
file with your OPENAI_API_KEY
.
To run the script:
cd 08-book-summarizer-project
python3 summarize.py
- preparing book text for summarization.
- handling context window math to respect the max tokens limit.
- adding summarization logic using recursion.
- caching results with hashing keys.
- performing a "meta-summary" with GPT-4.
Based on Mastering OpenAI Python APIs: Unleash the Power of GPT4 by Colt Steele (2023).