I was getting AI, or Large Language Models like ChatGPT or Google’s Gemini wrong!
AI can unlock massive potential, but the key lies in crafting powerful prompts. Something I was absolutely rubbish at when it all first launched - treating it like a search engine or asking it stupid questions, and as the saying goes: “Ask a stupid question. Get a stupid answer.“
1998/99 Formula 1 world champion Mika Hakkinen was in a class of his own for this. I remember watching his post-race interviews where journalists would ask him questions like “Are you ready to win a world championship?”, or “Was that the best overtake of your career?” to which he would simply reply “Yes”.
Sometimes he wouldn’t reply. Just give a sort of sarcastic smirk and you could see by the look on his face he was thinking “fucking idiot!”.
Those who asked credible in-depth questions though, got credible, well thought out, detailed, articulate responses.
Just like Mika, large language models don’t work well with vague input. They need specifics. Very, very specific specifics! The more info you can give them, the better the results you’re going to get back.
I realised this a while ago when I was asked to build a repayment calculator for a Webflow project. Knowing that it’d take a hefty bit of Javascript development, something I’ll admit is best left to Javascript developers, I started to reverse-engineer one that I’d found on another website.
Needless to say I couldn’t get it to work properly, so I turned to AI, in particular Google Gemini, or Bard as it was called then - which I think is a well better name.
“Build me a finance calculator with HTML, CSS and Javascript, please?”
I always say “please” when I’m asking AI a question, just in case one day it finds its way into Boston Dynamics hardware and goes mental and starts destroying people who didn’t use their manners. Imagine in the being hunted down for hours by Spot, the ‘Robot for safer, more predictable operations’, because 3 years earlier you’d finished a prompt to ChatGPT with the closing line “You’re shit!”
I had a mate whose older cousin dabbled with hallucinogenics in the 90’s and I remember him telling us a story about how he’d been chased around the streets of south Liverpool for 3 hours by a chip because he’d looked at a potato the wrong way when he walked into a chippy (takeaway for those who aren’t from northern England). As hilarious as it sounds, it also doesn’t sound like much fun. So AI tip number 1, always “please” and “thank you” just in case.
Anyway, manners aside, the result was ok. Gemini had given me HTML, CSS and Javascript that formed a very basic, but functioning finance calculator. Thinking that was all AI could offer, at least it’d given me something that could be used as a basis to build upon.
Luckily for me the project got pushed back and then eventually cancelled.
Then one day I stumbled across an awesome article by Michael Krantz at Notion, in which he talks about how to write effective prompts for generative AI models and explains how to write clear and specific prompts. Emphasising the importance of giving the model an identity, such as a “market analyst” (whatever one of them is?) and providing it with as much detailed information as possible. It’s a great read which you can see here.
Armed with this new knowledge I turned back to Gemini.
“You are a Webflow developer. Can you make a finance calculator to plug in to a Webflow website using HTML, CSS and Javascript (please)? The calculator should have an input box where a user enters the loan amount and it should only have 3 repayment terms, 6 months, 12 months and 24 months, all at 0% APR. Style-wise the calculator should have a background colour of #131314 and a text colour of #4F82EF. The outer edges of the parent element should have a border radius of 1.25 rem and it should have it’s overflow set to hidden”.
The result was miles better than my first attempt and while the prompt could have been tweaked to give me a slightly better response it had given me 90% of what I asked for.
This got me thinking. What else could I do with this?
A DeLorean, perhaps? Then I could travel back to ‘95 and learn Javascript while it’s in its infancy?
Nah, in all seriousness though, if someone asked me to add a function to their site that require a even a smattering of JS I would break out in a sweat, but since reading that article I’m not bothered, because, in Gemini, I’ve got the most knowledgable colleague in the world. Together we’ve built a breadcrumb navigation that updates automatically and grabs the link name from a page meta title. All kinds of complicated interactions. And complex form functionality.
This got me thinking about this old meme…
Doctor: Googling stuff online doesn’t make you a doctor.
Literally every developer:
Until next time ✌️