Ask HN: Can ChatGPT generate fully functional code?
41–50 of 69 posts
Re: Ask HN: Can ChatGPT generate fully functional code?
#42YEs, but in small blocks and with specific asks. I asked it to generate code based on an existing project of mine, which generates analytics from social media activity. It does a good job of producing function bodies from prompts equivalent to a short comment you might use to document your function in the IDE. For your example, I'd ask it to 'generate code, using Python, that accepts input and updates a display to al…
Re: Ask HN: Can ChatGPT generate fully functional code?
#43Re: Ask HN: Can ChatGPT generate fully functional code?
#44 I want you to send a single function in each response, I will say "Next" when I want you to send the next function.
I was able to get it to generate decently lengthy programs using this (on the order of a few hundred lines) that were syntactically and logically correct without any modification.
This may work for some languages better than others, though I imagine you can find some way to logically split up the program for most.Re: Ask HN: Can ChatGPT generate fully functional code?
#45I believe ChatGPT has some kind of response token limit, which is why longer code snippets commonly get cut off. I've seen some people recommend to enter something like "Continue your previous message starting from the last token", which sometimes works, but even when it does, it often breaks formatting, making it difficult to read the resulting code without copying it somewhere else. What I found to work better is i…
Re: Ask HN: Can ChatGPT generate fully functional code?
#46I believe ChatGPT has some kind of response token limit, which is why longer code snippets commonly get cut off. I've seen some people recommend to enter something like "Continue your previous message starting from the last token", which sometimes works, but even when it does, it often breaks formatting, making it difficult to read the resulting code without copying it somewhere else. What I found to work better is i…
All you need is to prompt it with "Continue" and it will keep going exactly where it left off.
Re: Ask HN: Can ChatGPT generate fully functional code?
#47Re: Ask HN: Can ChatGPT generate fully functional code?
#48Earlier quoted context omitted.
All you need is to prompt it with "Continue" and it will keep going exactly where it left off.
I've heard this quite a lot too, but it commonly doesn't work. I've had it respond thinking I was talking about using a `continue` statement somewhere in the code, and other times it simply just reprinted the whole code starting from the beginning. If you hit the "Try again" button enough it will usually eventually work, but it again has the problem where a lot of the time the formatting of the text gets messed up.
Re: Ask HN: Can ChatGPT generate fully functional code?
#49Re: Ask HN: Can ChatGPT generate fully functional code?
#50Take a look at this: https://www.dropbox.com/s/gq2hkp7w37c5y6q/ai.png?dl=0
It did write incorrect tests for non-Latin characters though.
Look at the mixed case tests below. Always the same string but sometimes a palindrome and sometimes not.
Same for the trailing whitespace test.
Maybe it got tired at this point. Could also explain why the performance test is missing warmup :D