New ask Hacker News story: Show HN: A new way to use GPT-3 to generate code (and everything else)

Show HN: A new way to use GPT-3 to generate code (and everything else)
194 by goodside | 60 comments on Hacker News.
Hi HN, One of the things that frustrates me about Copilot is that all tasks posed to it must be in the form of a completion. By writing clever comments you can get it to generate a few lines of code or a short function body, but you never get coherent long-form generations just from mashing the tab key. I’m working on a different approach. Instead of requiring you specify your code generation task through stilted comments, you can use GPT-3 to fill in what I call “instructional templates”. They’re like f-strings, except the English goes on the inside and the Python goes on the outside. Additionally, each instruction’s location and surrounding context can aid in interpreting it, allowing instructions to be impressively terse. I’ve collected 10 examples of the method on a Twitter thread here. Most code examples are in Python, but I also demonstrate generating CSV, NDJSON, R, Markdown, and HTML: https://twitter.com/goodside/status/1559801520773898240?s=21... [Edit: Clickable links in comment below.] I also have a few examples of more creative, non-program output in HTML and Markdown in this thread: https://twitter.com/goodside/status/1560953991722418177?s=21... Interested in any feedback, especially from anyone who’s tried to apply my method to their own problems.

Comments