Go (Almost) Anywhere: How I Built A Travel Site Powered by GPT, Plus Thoughts
By the time I publish this, people might be fatigued from GPT content. To those people, sorry! I was hoping to have Google ads by the time I went live so the site was more complete. Please head to the homepage and have some fun anyway.
AI generated image, of course
There has been a lot of debate on what ChatGPT/AI is or isn't, what it will or won't replace, and what may or may not come next.
Much of the debate has been heated. There have been a lot of semantics thrown around about whether it's ‘AI' or not. For many, it's a usable entrypoint to a powerful, sophisticated, and magical tool. Others see it as the end of their careers. Others still patronise the first two groups for either enjoying a toy or being so dumb they think a language model can do their job.
I want to show you something GPT3 can do and is good at. It will probably get better and then be used for other, greater things. Until recently, it wasn't even capable of what I've used it for. So right here, right now, at this point in time, here is something useful GPT3 can do:
It can plan a holiday pretty well.
This is a blog about building a website using GPT3 as much as possible.
Robot travel agent?
A little disclaimer about language. As I understand it, all GPT models are language models. They're commonly called AIs, too. GPT3 is what powers this site - it's a trained language model, the most recent and most powerful one available to the general public. ChatGPT is a version of GPT3 which learns from your input and allows you to iteratively 'chat'.
Like many, I had a lot of fun using ChatGPT when OpenAI first released it. I made it write poems in a pirate voice, refactor code, and failed to get it to tell me how to rob a bank.
It got me thinking about the types of thing GPT3 might be good for. I came up with these guidelines:
Given these things, I decided to build something I would want to use, a travel-planning site.
Travel planning requires trawling a blogs, reviews, and websites to put together the same plan thousands of people have done before you. In the same way that ChatGPT has replaced most of my Swurl (Google but cooler - see bottom of blog for more discussion) searches by synthesizing a probably-correct answer, it can synthesize a useful travel plan.
What DaysToDo does every time you make a request
Failure is acceptable because in the worst case, the traveller has to do their own research.
There's a wealth of resources to help people plan travel, even for niche lcoations.
But there's nothing at the moment flexible enough to help people plan custom trips - except for travel agents.
In the process of creating this site, I also used ChatGPT to:
- Write placeholder text before I had APIs
- Debug code (rubber duck debugging, too)
- Refactor code
- Write utility functions and extract hooks
- Interpret documentation - especially good for things I know I can do but can't remember how to do
- Write bash scripts to clean data and format stuff
First, release a travel site that looks professional that even my parents could use.
Monetise it slightly - I want to break even, just to see if I can. Travel agents make money; surely I can too.
My costs are high - the OpenAI API is expensive. To offset that, my server costs are minimal (hopefully in the free tier) and I don't expect to be compensated for my time.
I'm always curious about stacks when people posts MVPs and other projects, so here's mine.
To keep it cheap and easy, I used AWS Serverless to spin up Lambda APIs (no API Gateway because the lambda waiting on an OpenAI response can take longer than the 30 second timeout) connecting to the OpenAI DaVinci GPT3 API; DynamoDBs to store previous results to long-term cache requests; and NextJS/Vercel for the frontend, because I know how to use them.
Initially I used Google Cloud Platform and the Places API, but I found it hard to understand the pricing models. You get a pool of credit to share across services? And you can't set a price cap? I thought DaysToDo would be within a free threshold but during development it already cost me a whole 2 CENTS! Terrified, I replace GCP with AWS, and the Places API with a big-brain dumb idea - more on that later.
Monkey with technology
GPT3 as a Datasource
GPT3 is great at conversational responses. But to display information in a useful way in a web page it must be formatted. That way you can squeeze it into lists and html elements, and apply styles.
In order to get a good response, I needed to create a prompt that described what I wanted and the format I wanted it in. I tried JSON first, but the responses were often just JSON-like.
The inputs I use for simple requests
I ended up doing something like: "Give me a X day holiday in Y location in language Z. Do it in the format: XYZ". The format I used was to append and prepend strings to sections of the response, and use Typescript functions to extract the text between. If this fails, I dump the full response.
Why a language field? Because it's a tough feature to add to a website, but GPT can do it easily.
For the paid plan, I use more advanced inputs to craft a much more complex query - using a series of string functions to create a conversational prompt. I'm not worried about limiting requests here because users are directly paying for responses.
I also tried using the cheaper GPT3 models like Curie. They were wildly inconsistent and provided poor, generic responses at best. They also had difficulty understand the format I wanted.
The complex inputs
The crafting of a prompt with suggested formatting is undoubtedly hacky, and sometimes fails.I wouldn't use GPT3 for important customer-facing products. Not to mention without a way to self-host, you're at the mercy of OpenAI's reliability and pricing in a rapidly evolving space. The wait times on responses are also less than satisfactory for end-users who are used to instant APIs.
On an aside, something else I got a lot of value out of was cleaning up my messy code. I prescribe to the same theory novel writers do - first drafts should be messy and fast, and if you still care when you're done you can edit it. Speed is of the essence to capture my ever-diminishing attention-span. ChatGPT helped me split up big files, refactor hooks, and tidy over-complicated logic at the low, low cost of adding my code to its dataset! (disclaimer: if this site ends up being worth billions, may not be a low, low cost)
A Thing ChatGPT Didn't Help Me With
One thing I use ChatGPT for in my day-job is to write bash scripts. As long as you proof-read them, they probably wont blow up your computer.
To replace Google Places, I decided to implement the worst practice I learned during my last year of university. Back then my friends and I had to build a website with a backend that stored data on family heirlooms that a family could use to track objects. We didn't understand how a backend worked, so every time the frontend needed some data, we simply downloaded the entire database and operated on it in the browser.
Me submitting my uni assignment
If I could get a list of places small enough not to (too) badly affect the bundle size, I could do the same thing to power the places search bar.
Another benefit to limited inputs: restricting the uniqueness of possible requests, so I can cache results and avoid using the OpenAI API as much as possible - giving users a free text field would kill my wallet.
I found some open datasets with places and populations, and a bunch of other fields I don't care about. I tried getting ChatGPT to write a script to extract places with populations above a threshold but even after a lot of iterations, bad data in the CSV set would throw it off.
Finally I used Excel to filter and cut data until I got the list I wanted.
Classic lesson re-learned: no matter how much you want to, think before you try automating a simple task.
One common theme emerging about language models is the idea they'll make information on the internet shittier and shittier. It's probably right.
Case in point: I used ChatGPT to write blog posts I'm using as SEO content. I barely proof-read them. I have hopes they'll rank okay, and it's crazy easy to churn them out.
Is it good for the internet? No, but that's a consequence of SEO rather than ChatGPT. Millions of these blogs already exist. Language models have simply expedited a previously laborious task.Instead of interns churning out articles, anyone can (and in my opinion should) do it - this will be the golden era of SEO for developers who don't write good, or just want to code.
Not AI generated. AI Zoolander gave me nightmares. Best to stick to monkeys.
I hope it'll force search engines to find new ways to rank content and we'll see the end of low-quality blog posts, pages with a million search keys appended, and copy/pastes from stack-overflow. Maybe, just maybe, we'll even see recipe pages without someone's life story at the front. Or maybe we'll see new search engines?
I've played with DaysToDo a lot and my friends have used it a bit, and I think my site does not make the internet shittier. It's actually quite insightful. In my biased opinion.
My plan is to post this blog on Hacker News and some other places in the hopes people generate a large number of places.
I'll cache this content, generate a sitemap, and get Google to crawl it, hopefully building up a large site that ranks well for travel searches. Maaaybe this will feed back into another language model in the future, diluting the internet.
My thanks to anyone who uses it. I'll be reading Hacker News comments for feedback too, or you can email me at email@example.com.
ChatGPT probably made me a dumber developer. Outsourcing simple tasks like refactoring saved time, but skipping simple tasks to focus on bigger ones made me worse at solving simple tasks when ChatGPT couldn't. There's a balance to be struck where you still need to use your brain every now and then.
I know the whole argument about people saying the same thing about calculators, and Socrates (and/or Pluto?) hated writing because it caused forgetfulness. History has made Socrates look like a buffoon on this one and it might make me look like a buffoon too, because I think language models WILL make humanity dumber. In the same way we acknowledge exercise is hard but good, we should accept that thinking is also hard but good. We must resist the temptation to outsource everything, even though the drive to be lazy might be what led us clever monkeys to where we are today.
The monkey and the machine
On a random tangent - I think the internet is outpacing society's mental capacity. We see this in disinformation campaigns, radicalisation, incel groups, etc. Our monkey brains just aren't smart enough to resist the lure of deep-faked Tom Cruise's, or fake tweets, or random internet commenters who appear to have a consensus via public voting. It might be the Great Filter all civilisations hit at some point. Where do language models fit into this? I think they have the potential to damage our already-suffering capacity for reason and critical thinking, at a time where it matters most. What to do about this? Maybe invest in schools or something? I don't know, I just make websites.
Anyway, I like DaysToDo and I'm proud of it. I think it's useful, it might make a positive income, and it's the first project I've actually finished (finishing it was such a great feeling I put off making this blog posts for weeks because I was so satisfied - oops).
Hope you enjoy it too!
Some Random Thoughts
For anyone interested in things that didn't make the blog.