How OpenAI Ruined My Homework Assignment but Helps Coders
OpenAI has ruined my favorite assignment from when I was (briefly) a high school English teacher: Come up with a two-sentence horror story. All you really need to do the assignment is a topic and an idea of what’s frightening. It seems so… human and creative, and yet, OpenAI does it better than most of my high school students ever did.
What does OpenAI, which launched ChatGPT to much fanfare last week, offer developers? I fell down a rabbit hole exploring the private artificial intelligence company’s playground options. And while they may have ruined my 2018 teaching curriculum for Halloween — as well as any essay plans I may have had — they actually offer some interesting solutions that might help developers do their job; assuming you verify the results first, since currently, it has a propensity for generating errors.
There are several translation functions, including (of course) one for human languages. But for coders, one useful translation function is this playground, which takes a complicated piece of code and explains what it does in English. Just put the code in and it will create a nice summary for your comments. This is free and relies on Codex models currently in beta. On a related note, it will also translate from one programming language to another, so developers can use the comments to specify the source and target languages.
In that same vein, you can play with:
- Translating natural language to SQL queries; and
- Translating a piece of Python code into “human understandable language,” by which it means English and math.
One of the more intriguing uses of AI is its ability to fix problems. Granted, the newly released OpenAI chatbot ChatGPT made headlines mostly for its mistakes — including describing absolute monarchy supporter Thomas Hobbes as a federalist — but it’s learning. Or at least OpenAI wants developers to help it learn — they’re running a feedback contest through Dec. 31, 2022.
Other “fixing stuff” offerings are its Python bug fixer and the ability to parse unstructured data into tables from the long-form text, which it does by allowing the developer to specify a structure and supply some examples.
When it comes to creation, we’d like to think we can one-up artificial intelligence. And we can … for now. But several OpenAI projects are actually aimed at creating code out of natural language.
One feat that attracted quite a lot of media attention this week was the ChatGPT’s ability to mimic a linux virtual machine. There’s also a playground model that will create code to call the OpenAI API using natural language instructions. It’s in beta for now.
This playground will calculate the time complexity of a function. Another model creates simple SQL queries. It demos the creation of a SQL request to find all users who live in California and have over 1000 credits, but it functions like the other playground in that you can substitute your own SQL requests to build a function.
For those who need to implement the payment functionalities of Stripe, there’s a model that creates the code to call the Stripe API using natural language.
Finally, there’s a code generation model that will create a Python docstring for a given Python function. “We specify the Python version, paste in the code, and then ask within a comment for a docstring, and give a characteristic beginning of a docstring (“””),” the playground explains.
And in a meta offering, OpenAI also includes in its examples a machine language/AI language model tutor. Basically, it’s a chatbot that answers questions about language models.
If those use cases and examples aren’t intriguing enough to lure you in, then there’s a category of models I’m just calling “weird.” For instance, one model converts movie titles into emoji. You can see what that looks like in the accompany image — I added The Good, The Bad, The Ugly.
And if all of this fails to amuse you, there’s always Marv the sarcastic chatbot. It probably wasn’t modeled on Marvin the Paranoid Android from The Hitchhiker’s Guide to the Galaxy, but it does a darn good impression.