I really like to read and listen to audiobooks — thankfully the library has both physical books as well as audiobooks and ebooks available and Amazon fills in the gaps if I want to buy the book. I track all the books I want to read and have read in Goodreads.
There is always a long list of books that I have listed as “to-read” but sometimes it is hard to make a decision about the next book to select. This is because 1. the “to-read” list is really long which means I get decision fatigue, bias toward books I’ve just added, and then forget about the books I added a while ago and 2. I may be in the mood for a specific genre of book but have a hard time sorting those out in the Goodreads list.
OpenAI’s ChatGPT does an excellent job understanding a question I have and then making a recommendation to me based on a set of criteria I’ve given it. Because of this, I decided to see if ChatGPT could recommend me the next book I should read!
Goodreads has functionality that lets you export your full list of books that you’ve marked as “read” or “to-read”:
From there, I built a Streamlit app that let’s you:
- Choose the genre of the book you are interested in reading next
- Choose if the book should be fiction or non-fiction
- Choose the range of dates you want to want to sort through (in case you want to focus more on recent books your read or saved or books from longer ago)
Then, once you’ve made your selections, you can upload your Goodreads list, and then ChatGPT gets to work. We ask it the following question:
question = '''Based on this list of my previous read books, please recommend a ''' + fiction_nonfiction + ' ' + genre_selection +''' book from my to-read list and paste a link to the Amazon listing so I can buy it.
Here is my read list: ''' + books_read + '''
Here is my to-read list: ''' + books_to_read
The code takes a little while to run (sometimes about a minute but sometimes faster), but once complete, it lists the choices you made and the recommendation along with why the recommendation is being made. This works surprisingly well, almost always giving me a recommendation from my “to-read” list that matches the choices for genre I made (a few times I’ve noticed that it will recommend a non-fiction book when I asked for fiction, etc).
An interesting thing is that I did ask the algorithm to give me a link both to the public library and to the Amazon listing. The algorithm does give a link, but it never works. It must be assuming the structure of the link based on what it knows about how Amazon creates URLs and the title of the book, but the link is not real.
This seems like a fun application of ChatGPT that can provide a better way for me to select books I’m in the mood for at that point in time. Something like this could be useful for a book club as well!
All the code to make this work lives here: https://github.com/samedelstein/goodreads_chatgpt
You just need to create an OpenAI API Key and add it to the code to make it work (I just don’t feel like paying for the credits to make this work for everyone!).