Saturday, August 20, 2022

Show HN: A new way to use GPT-3 to generate code (and everything else) https://news.ycombinator.com/item?id=32532875

Show HN: A new way to use GPT-3 to generate code (and everything else) 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. Unlike f-strings, though, each instruction’s location and surrounding context can aid in interpreting it. 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&t=-r-dR8pkhZ3lfCpeLOWqvw I also have a few further examples of more creative, non-program output in HTML and Markdown in this thread: https://twitter.com/goodside/status/1560953991722418177?s=21&t=-r-dR8pkhZ3lfCpeLOWqvw Interested in any feedback, especially from anyone who’s tried to apply my method to their own problems. August 20, 2022 at 08:45AM

No comments:

Post a Comment