OpenAI and StackOverflow

I used GPT-3 to answer my SQL question on StackOverflow. I was shocked at the quality and conciseness of the answer!

To be honest, I was just curious if it could handle the formatting I wasn’t expecting an actual answer. I am absolutely floored!

sql - Querying certain values inside a RECORD type - Stack Overflow

edit: here is the prompt: OpenAI API

3 Likes

I’m always amazed at the code it can create. If you use beta edit mode inside of the playground you can generate code essentially for free while it’s in beta. For example:

input:

var helloWorld = "hello world";

instruction:

modify the javascript code to iterate through each character in the var helloworld and store each character in its own index in an array named const stringArray, add comments explaining the code.

sample output:

var helloWorld = "hello world";

//create a variable to store the array of characters
const stringArray = [];

//iterate through each character in the variable helloWorld
for (let i = 0; i < helloWorld.length; i++) {
  //store each character in its own index in the array
  stringArray[i] = helloWorld[i];
}

console.log(stringArray);

My sentence structure could use more work too and it still understood what i wanted.

I fully expected this kind of question to be downvoted by Stack Overflow and it was. I stopped asking questions there several years ago, because the answer is always “what have you tried” or “duplicate of unrelated question”. It’s especially frustrating since you have to make some code public and it gets downvoted as a “XY problem” but if you give full details it’s downvoted as a “homework problem”. I look forward to the day that AI obsoletes Stack Overflow. I’m tempted to just make a site around this, lol.

I love how simple the prompt is too. I’ve been trying to get better ones with more words, and you get the answers with literally a letter. Have you tried using Codex instead of davinci though? It’s supposedly better for code and free for now.