Tuesday 1 November 2022

Playing with AI tools

Good ideas often come from exchanges with interesting people. In my case, I saw this tweet from Molinos last Summer and thought it should be relatively straight forward to do something similar as a DIY project, but instead of quotes with the time, quotes with the date. The only issue was how to figure out a quote for every day. Scraping huge amount of books is an option although, honestly, it looks like a bit of a daunting task. There are Wikipedia articles of things that happened on a given date. And of course there are always searches in Google that can be parsed. I was just finishing my holidays and I did not have neither the time nor the energy to try anything at the time, so I put it in the back of my mind.

Fast forward to today, I am on holidays and I recently saw a post of somebody who had added a GPT-3 function to a google sheet to autocomplete columns. I had the Eureka moment that GPT-3 could probably complete the task with an adequate prompt, so I decided to give it a try and was amazed how easi it was to accomplish something (not saying that the something was any good, keep reading). These are some of the autogenerated results for a few dates:

"The first of January is the day on which we all start afresh, with new aspirations and hopes for the coming year." - The Alchemist, Paulo Coelho

"Second of November, huh?"
-The Catcher in the Rye, J.D. Salinger

"It was the third of November. The wind was howling outside, and the rain was beating and splashing against the windows."
-The Adventures of Sherlock Holmes, Arthur Conan Doyle

"The Fourth of November is a date which we should never forget."
- A Tale of Two Cities, Charles Dickens

"Remember, remember the Fifth of November, the Gunpowder Treason and Plot, I know of no reason why the Gunpowder Treason should ever be forgot."
-V for Vendetta, Alan Moore

The one question I have though is if the quotes are real or if they are autogenerated but fake. A bit of googling did not really answer the question since just because you don´t find something it does not mean that it doesn´t exist. And of course there may be different versions of a book if it has been published multiple times. 


I have been changing the prompt to try and provide as clear instructions as possible. This is the latest prompt I am using with the davinci engine:

Quote from a book in the public domain including  either "first of November" or "November, 1st" and mandatorily using the exact text in the book. Next to the quote, add the title and author of the book from where it was extracted.  The quote must be less than 200 characters. If no exact quote available containing the required text, don´t invent a quote, just write "quote not found". Case of words is not relevant.


GPT-3 is not deterministic, so you can run several times the same prompt and see what comes out. For example, this is an interesting coincidence...

"First of November was a cold day."

The Tale of Peter Rabbit by Beatrix Potter


"First of November was a cold day."

The Call of the Wild, Jack London


"First of November was a cold day."

-The Adventures of Sherlock Holmes, Arthur Conan Doyle


The books and authors definitely exist. Whether the same sentence exists in all books, I don't know. I tweaked the prompt from "the exact text in the book" to "the exact text from the book" and got this.

"First of November, 1892," he said. "I shall never forget it."

The Adventures of Sherlock Holmes

by Arthur Conan Doyle


"First of November was come, and many little birds were dead; but Mrs. Partington said they might have died any day, so it was no matter."

The Life and Adventures of Mrs. Partington

by Kate Douglas Wiggin


I wonder if I should do a twitter bot similar to the CalendarPuzzle bot.


Edit: Instead of creating another bot, I just added the quote to the existing one. Let´s see how it works in the next few days.

No comments: