4 ms·
Thanks for sharing promptr! I will try it out. I have also been exploring a similar pattern for using GPT as a coding collaborator: - Send all the (relevant
by anotherpaulg 4y ago
Thanks for sharing promptr! I will try it out.
I have also been exploring a similar pattern for using GPT as a coding collaborator:
- Send all the (relevant) code to GPT along with a change request
- Have it reply with all the code, modified to include the requested change
- Automatically replace the original files with the GPT edited versions
- Use git diff, etc to review and either accept/reject the changes.
GPT is significantly better at modifying code when following this "all code in, all code out" pattern. This pattern has downsides: you can quickly exhaust the context window, it's slow waiting for GPT to re-type your code (most of which it hasn't modified) and of course you're running up token costs. But the ability of GPT to understand and execute high level changes to the code is far superior with this approach.
I have tried quite a large number of alternative workflows. Outside the "all code in/out" pattern, GPT gets confused, makes mistakes, implements the requested change in different ways in different sections of the code, or just plain fails.
If you're asking for self contained modifications to a single function, that's all the code that needs to go in/out. On the other side of the spectrum, I had GPT build an entire small webapp using this pattern by repeatedly feeding it all the html/css/js along with a series of feature requests. Many feature requests required coordinated changes across html/css/js.
https://github.com/paul-gauthier/easy-chat#created-by-chatgpt https://github.com/paul-gauthier/easy-chat#created-by-chatgp...
Another HN user has also released a command line tool along these lines called gish:
https://github.com/drorm/gish https://github.com/drorm/gish
- deathmonger5000 4y agoWe're thinking the same thing. You might be interested in the prompt template I used to make GPT respond in json format here: https://github.com/ferrislucas/promptr/blob/main/templates/refactor.txt https://github.com/ferrislucas/promptr/blob/main/templates/r... Having GPT's response in json was useful to be able to easily apply the changes GPT wants to the filesystem. GPT4 is significantly more consistent with only responding with json. Gish looks cool!