Repository navigation
apply_patch-like tool for OpenAI models
#3898
nyxkrage
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
GPT-5.1 and newer are trained to edit files with OpenAI's
apply_patchtool and its V4A patch format. I propose giving those models access to anawait apply_patch(r'''*** Begin Patch ... *** End Patch''')tool in the Python REPL, withedit()kept for every other model. A single patch can update, add, delete and move several files, so a multi-file change takes one call instead of a chain of exact-matchedit()calls.Codex uses
apply_patchas its main editing tool for these models.One thing to take care about is the edit format should follow the session's current model, so switching models swaps the edit guidance and the available tool.
Quick benchmark, a four-change edit task on an existing package, 3 runs per model, official OpenAI API:
edit)apply_patch)The increased cost for sol on xhigh is likely due to the shortness of the task, and is probably noise.
I have a working implementation on my fork (https://github.com/nyxkrage/prime-agent/tree/feat/apply-patch). It's on by default for GPT-5.1+;
editFormatinmodels.jsonchanges it per model, and"applyPatch": "off"insettings.jsonturns it off everywhere.All reactions