Web Prompts: Rewrite the web with GPT-3
I’ve been inspired by Riley Goodside and Simon Willison’s explorations of what GPT-3 can do with the right prompt and how you can trick it with clever hacks. As I was looking through these tricks it dawned on me that you might be able to rewrite a web page to show you just the information you want. Instead of having to scroll through someone’s life story to get to the recipe you were looking for, you could just get GPT-3 to rewrite the HTML of the page to only show you the recipe, or a summarized version of an article, or a table with all the events in a story in shown in chronological order. Any view would be possible.
After some promising manual experiments I decided to write a Chrome Extension that would take a prompt and rewrite a page so that I could do this on any page. The Chrome extension calls a Cloud Function that extracts the text from the page and sends the text and a prompt to GPT-3 which outputs HTML. The HTML is injected into the current page along with some javascript and css, essentially letting the user create a custom view.
So for example, here’s a summarize prompt for this news story:
Which creates this page in the same tab:
When you close the page you end up back at the original page you ran the prompt on.
It’s amazing how flexible this idea is and how much GPT-3 can do. Some more examples:
Limitations
While each of the screenshots above is the actual output of the chrome extension its currently limited in the following ways:
- Newspaper3K is used to grab and parse the content of the website. Its a python library that is meant to scrape news articles so it works really well on news content and sometimes works on everything else.
- OpenAI limits the number of total tokens you can use in the prompt to 4500. A word is ~1.25 tokens and a typical output is 1500 tokens so that limits the text you can use as input to ~2500 tokens.
- It’s slow…so slow. On average it takes a 3-4 seconds to produce the web page.
If you could somehow remove these limitations, make it almost instantaneous and build it into the browser I think this would be a really powerful user experience.
I wonder if there are only a handful of views that everyone would want or if, like image generation prompts, the possibilities are endless and building unique and powerful views is a skill a user could hone.