Learning GPT is a Little Weird
Large Language Models (LLMs) like ChatGPT and GPT-3 are cool examples of what gets me excited in tech - They're incredible models, but the programming language is English (Or, Spanish, French, Klingon, Whatever!), which makes it easier for everyone to use.
In the last week I've gotten to sit down with a handful of folks as they use ChatGPT for the first time, and a constant thing I hear is "Hey it doesn't know about
X that I need, this won't help me at all!" Substitute
X for anything new in tech - Of course it doesn't know about it yet!
Thankfully - You, the big powerful human brain, can help the computer brain solve its problems. GPT will read whatever you throw at it and do its best to give you an answer! It still might be bullshit, but if we give it facts or examples it'll be closer to reality.
ChatGPT and GPT-3 Love Examples
What is an example?
Anything that you paste in is my vote. This truly means anything - if it doesn't know a library, paste in examples.
If it gets something wrong, or if you need it to work on current code that its never seen (which is... most of it if you're doing new stuff!) you just paste in how you currently do something, or facts relevant to what its writing - and it'll handle more of the rest.
An Example Example
I've been raving about PineconeDB because it's so easy to use, and good. Unfortunately, ChatGPT has a bit of a hard time:
It's confident, it gets the idea, it knows what pinecone is - But that code is not correct!
If you're a noncoder, don't stress - It'll make sense soon. Think of this as it misremembering presidents or something - we'll just hand it facts to help it.
So what we can do is paste directly in from the Pinecone Python Client Docs, which shows us how its used now.
It's still spitting out BS for how to install the package - BE CAREFUL INSTALLING THINGS FROM PIP STRAIGHT FROM ChatGPT! But the code is largely correct now:
And the same idea works for anything - If ChatGPT (Or GPT-3!) bullshit you - reinforce your position with facts and it'll fix itself for the most part.
You can see the actual ChatGPT log here
One Last Example - SQL
Now look, I'm a machine learning guy, but I hate SQL. My brain doesn't work that way. The good news is, since 95% of software is just reconfigured stuff it's seen before, it can do most of it for me.
In this case we'll just start with a postgres table example:
The big thing here is pasting in your whole table definition - types and all. With that it'll make queries with no real issues. I've had it do some intermediate SQL (the kinda thing I would spend an hour or two googling - to get wrong), and it definitely does better than I do.
The kicker is if you tell it postgres - it'll spit out postgres queries. Etc, etc, etc.
Likewise, see the chat log here
ChatGPT and GPT-3 Reward Good Habits
But John - Our codebase is a mess! I can't find types! How do I know what the tables look like?!
This is the exciting part - Crushing tech debt now has real rewards because GPT can move faster than you with good code. The kicker is that stuff like good variable names, types, and comments help you the human parse the code faster.
The added bonus here is ChatGPT can help you get there - pass in some messy code and ask it to refactor it, or remove old BS you don't need anymore. It does great. Adding comments and types are usually trivial too... Which helps GPT build more code for you, which it will add comments and types to, and so on!
That's the thing with LLM's like ChatGPT - Anything you do to help you understand something better also helps it. Just paste it in and try it!