Coding Gabrielle: Six chatGPT superpowers for coding and other life situations
Welcome back to Dear AI, where the AI and I share insights on working together on a project. Specifically, we're building Gabrielle.Day, the AI-powered advice columnist. In the previous post, we talked about using chatGPT for planning. Today's post looks at the technical collaboration with chatGPT to set up and build the experience.
It took 1.5 weeks to build the current version of Gabrielle.Day with ChatGPT. It was a lot of work, and we split the lessons into three parts:
1) The email-based advice service: With one useful mental model and six superpowers of chatGPT ← today's post
2) The Gabrielle.Day website: with additional AI tools beyond chatGPT, including some design.
3) Observations on the technical collaboration: what it feels like to work with an AI teammate and the challenges.
Basics: How Gabrielle works
Gabrielle's service is simple. Send an email asking for advice, and get a response. Gabrielle's witty responses are powered by OpenAI's API, which lets developers build applications using chatGPT. As the diagram shows, we 'simply' had to connect the email to chatGPT.
It's hard to believe that we finished it, despite my rusty programming skills and no familiarity with the systems we used. But, ChatGPT gave our little team superpowers and got us to the finish line. Here are some of the things that worked for us:
A tree-like approach to building with chatGPT
One mental model I often use is a tree-like structure of what we are building together. For example, we started with the overall idea of the automated email service. When I described it to chatGPT, it gave an overview of the system level. Then, going one level deeper, chatGPT outlined which components we need to develop, e.g., to receive emails. This process continued, leaving placeholders in the areas we didn't get to. Then, at the bottom, chatGPT made quick work of tasks like converting emails to plain text or hiding email addresses so Gabrielle could make anonymous requests to OpenAI's API.
This is similar to how chatGPT helped with frameworks in the previous post about planning with chatGPT. Besides the fact that the tree structure helps organize the overall work, it helps with setting context to overcome chatGPT's 'limited memory.'
ChatGPT has limited memory?
Yes, it does. When you chat with chatGPT or similar AI experiences, it doesn't just read your last question but considers the conversation history. But there's a limit to how much history it takes in. These limits are only sometimes advertised, and they grow with better models. But generally, the AI will forget older messages past several hundred or a few thousand words.
The mental model of the tree then comes in handy. You can include the most crucial context in a short summary of the project, plus the immediate step above in the tree. So, for example, to give that context to chatGPT, I might write:
"I'm working on Gabrielle.Day, an AI-powered email advice columnist. I am writing the code to get the AI response - see the outline below. Can you help me write the API request in the OpenAI API format?"
Then I follow that with the outline code I'm trying to fill in. That is usually enough for chatGPT to quickly fill in the blanks.
6 ChatGPT superpowers for coding and more
These superpowers are illustrated through examples from building Gabrielle.Day. Don't worry if you miss some technical details; the patterns matter and can also apply in non-technical contexts.
1) Choose between options:
ChatGPT is an excellent way to research and reason about different options. You can even ask for recommendations to meet your needs.
We needed an auto-reply function for Gabrielle's emails. When an email arrives, Gabrielle needs to write a response and send it back. I had heard of Amazon Web Services (AWS) Lambda functions - where you can define and run simple code functions without a server. I'd also heard of Zapier, which can run tasks between different apps without code. So I asked chatGPT about them.
It confirmed AWS and other cloud platforms like Microsoft Azure and Google Cloud Platform (GCP) all have "serverless functions" that could work. For Zapier, it said:
"Zapier can be a good option if you don't have the time or resources to build your own serverless pipeline. However, it is important to note that Zapier has limits in terms of the number of tasks that can be processed per month."
"For example, on the "Starter" plan, which is the lowest tier, you can run up to 750 tasks per month [...] Each email would typically count as one "task" in your monthly limit, so if you were processing 750 emails per month, you would be using up your entire quota on the Starter plan."
I double-checked Zapier's pricing to confirm, and it got it right! I ruled it out due to these limits being too low/expensive. I then asked chatGPT to compare AWS, Azure, and GCP. It gave this table and a recommendation:
"Based on your project requirements, AWS may be the best option as it has a large and mature ecosystem of services, including built-in integrations between SES and Lambda that make it easy to build a serverless email processing system. However, if you have experience with other cloud providers or prefer a simpler user interface, Azure or GCP may also be viable options."
I explained we don't need a lot of integrations, and ChatGPT reasoned:
"In that case, it may be worth considering GCP as a potential option, as it has a strong focus on serverless computing and has a simple and intuitive user interface that may make it easier for you to set up and manage your system.
With GCP, you could use Cloud Functions to trigger a call to the ChatGPT API whenever an email is received via Cloud Pub/Sub, and then store the email contents and response in Cloud Firestore, which is a NoSQL document database. You could also use Cloud Logging and Cloud Monitoring for analytics."
"Simple and intuitive user interface" won it, and I chose the Google Cloud Platform for the project.
ChatGPT also helped choose options for an email provider, a hosting service for the website, and more. Overall, it saved me a lot of time and effort in researching the best options for the project.
Bing chat is another excellent option for this research because it searches for the most up-to-date information. In addition, it includes links to sources, which makes it easier to double-check the details.
2) Walk me through it
I love this prompt: "I'd like to do X. Can you walk me through it?" It's like a personalized tutorial for the world! And when it's some technical setup with too many options, it can be a huge time-saver.
I tried this while building my first function on the Google Cloud Platform. I started creating one and quickly panicked when I saw all the options I had to configure. But ChatGPT knew what I was trying to do and just gave me the instructions:
This saved me so much time in setting up the email server, website hosting, GCP elements, you name it. Indispensable.
The biggest challenge is that chatGPT was not trained on any data past September 2021. So if something changed since then in the product you're asking about - it may not be reflected in the instructions you get. A couple of workarounds are:
a) Try Bing, which searches the web for up-to-date information before answering - and may recognize new ways of doing things. (Also coming to chatGPT soon…)
b) If some step seems impossible, describe the problem to the AI and see what it says (For example - "I can't find the Permissions Tab")
3) Text-to-code
The most famous of all use cases where chatGPT helps with coding. Tell it what you need, and it will code it for you. Here's one example where it wrote me a function that sends a canned email response:
Besides coding from scratch, I've found this helpful in two more ways:
a) Write nuisance calculations:
There are often cases where I need to write a mini-calculation. These are easy bits of code that do simple things, like converting time from Eastern Time to GMT, finding all the emails in a specific text, or organizing some data from a website in a table. These are easy to write but still take time and mental effort. Asking chatGPT to write them is much faster. Here's one example:
b) Complete or adjust my code:
This happens when I already have some code written and need help to change it. For example, I set up a function to load AI personas from the database (Gabrielle has many AI columnist friends, and you can define your own personas, too!).
In another part, I needed to load some background details called "secrets" from the database. The storing of personas and secrets is similar. I could have copy-pasted my code, edited from "persona" to "secret," and made some adjustments manually. But ChatGPT did it much faster, and even explained what it did:
4) Help me out!
ChatGPT is decent at writing code - it works more often than not! However, when it doesn't, and the code crashes with some error, ChatGPT can fix it.
This is a typical help-me-out flow:
ChatGPT writes code
I run the code and get an error message
I ask chatGPT, "I see this error: X." I add the code if it isn't in the recent chat.
ChatGPT suggests some fixes and usually explains them
The fixed code works, and I'm happy again; maybe I even learned something.
Here's an example:
5) Teach me
I enjoy learning from chatGPT as we work together. There's no shame in asking for explanations when I don't understand something.
For example, it can explain:
Code ("Can you explain what this does?")
Technical concepts ("What is an async function and await?")
Specific programming patterns ("What's the difference between let, var, const, or not using either when defining a = 5?")
Best practices ("In general, which of those is the best practice?")
I also don't have to pretend I got the explanation the first time - I can easily ask again. You could try prompts like: "Explain this to a middle schooler" or "Can you give a simple example?"
6) Check my code
The last superpower for today and quite a magical moment with chatGPT is checking code. This relates to the idea of feedback from the previous post, but super helpful with coding. When you have a piece of code - just show it to chatGPT and ask, "Would this work?"
ChatGPT found so many bugs before I even tried running the code. So I now ask for a code check before I run anything - it's faster than waiting for error messages and figuring out what went wrong. Here's one example, including the fixed code and an explanation:
How to use these superpowers in everyday life
While the examples above are about coding and technical stuff, you could use similar patterns for everyday life. For example, you might:
Choose between options: Tell Bing what you're looking for in a new phone, and ask it to help you decide.
Walk me through it: Ask chatGPT to guide you through making your first lasagna or fixing a clogged sink.
Text-to-code: let chatGPT turn your angry thoughts into politely worded corporate emails (See this hilarious comic and this cute complaint after a flight delay.)
Help me out: For example, when "My washing machine won't spin, and the clothes are still wet after the cycle."
Teach me: Ask chatGPT to explain how plants grow or how touch screens work.
Check my code: Find typos in your documents and fix them (more about some great writing tools coming up in another post.)
Part 1 summary - coding with an AI teammate
I continue to be fascinated by this process of working together with AI. If it started by asking it to do simple tasks, it's gone far past that. Building Gabrielle has become a full collaboration where the output exceeds the sum of its parts. It's not just my work nor just chatGPT's contributions. The collaboration process adds value, and creation emerges. It's incredibly empowering to have this collaborative teammate so accessible, and I bet we'll see this type of collaboration a lot more.
Of course, there are challenges along the way - we'll look at those and ways to get around them in an upcoming post.
What do you think?
Have you found any chatGPT superpowers that you've come to use regularly? Let me know in the comments, and feel free to ask any questions! Also, comment below if you're interested in the technical details of how Gabrielle works - systems, APIs, prompts, etc.
Remember to email dear@gabrielle.day 24/7 for heartwarming advice about anything on your mind, or write me at itai@gabrielle.day If there's anything specific you'd like to ask or suggest.
Liked this post? Share with others who might like it too!