Skip to content

fix: update apply_patch format instructions to be consistent and include required space #531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

agreaves-ms
Copy link

ApplyPatchFormatInstructions

  • Made sure the model knows to always have a space before [context_before] and [context_after]
  • Made sure the model knows to always have a - before original old code lines
  • Made sure the model knows to always have a + after new code lines

ApplyPatchInstructions

  • Explicitly tell GPT-5 to not use ApplyPatch for create file (GPT-5 would try and create a file with apply_patch then fail over and over until eventually using the create_file tool)

Details

The apply_patch instructions and description would sometimes confuse the models and produce patches that where either missing an additional space infront of unchanging context lines, or it would consider - characters from the original text as old code lines.

{isGpt5 && <>Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br /></>}
{isGpt5 && <>
Never use {ToolName.ApplyPatch} for creating files.<br />
Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br /></>}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do we need these instructions? Would they limit GPT-5 at all and have GPT-5 focus on only making small simple changes?

Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants