This is a test of OpenAI’s davinci-codex engine, Natural language to python preset.
default-english-to-python playground
It’s not perfect, but really useful.
OpenAI has been working on AI language prediction models for a while. Language prediction models are AI that specialize in generating what comes next. So, you usually give them the start of something, and they try to finish it. Formatting a request is usually done as:
-
Some kind of context:
- A little bit of text that informs the AI of what kind of thing you want back. Example:
“In Python”
“A cooperative company’s email response to a customer:”
“An amazon product listing for an electronic device”
-
A prompt:
- A set of steps to follow, or what you use to request from someone.
Steps to follow in the process of some code.
“Write an email to a customer that has requested a return.”
Steps to make up an electronic device and then write product copy text.
-
An example of a response (optional, but usually helps it get better at that you are looking for)
The model I’m using now is a few variations of OpenAI’s GPT-3 (Generative Pre-trained Transformer). It is a language AI that was trained mostly on public internet content, and the internet contains a lot of code, so naturally it’s pretty good at coding.
You can check out: GPT-3 Wikipedia
I’ve been floored by its performance a few times now. I am using it for python programming, but it can be used to accelerate almost any text-based workflow. GPT-3 doesn’t usually come back with the exact answer you want. I think of it as a super search engine that has read a ton of stuff and will try its best to answer your question. Not usually right but will get you going in a direction fast, code it generates usually isn’t nearly the best, if it even works.
It is an amazing technology. Having a clumsy superintelligence to bounce ideas off is really helpful.
-
It decided to create a random_date function before completing any of the requested steps
-
It figured out that if the list was sorted it only needed to grab the first and last element
-
It added a bit of extra code (kinda humorous) that checks if the datetime happened to be generated exactly