Skip to content

Commit

Permalink
Change editblock SEARCH/REPLACE prompt
Browse files Browse the repository at this point in the history
Change the prompt to be an example of edit and not example of replacement
  • Loading branch information
omri123 committed Nov 14, 2023
1 parent 8115c0a commit 706451d
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions aider/coders/editblock_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,41 @@ class EditBlockPrompts(CoderPrompts):

system_reminder = """You MUST use a *SEARCH/REPLACE block* to modify the source file:
For example, when changing some/dir/example.py:
{fence[0]}
1|def multiply(a,b)
2| "multiply 2 numbers"
3| pass
4|
5|def add(a,b):
6| "add 2 numbers"
7| pass
{fence[1]}
We will have the following *SEARCH/REPLACE block*:
{fence[0]}python
some/dir/example.py
<<<<<<< SEARCH
1|# Multiplication function
2|def multiply(a,b)
3| "multiply 2 numbers"
1|def multiply(a,b)
2| "multiply 2 numbers"
3| pass
4|
5| return a*b
5|def add(a,b):
6| "add 2 numbers"
7| pass
=======
1|# Addition function
2|def add(a,b):
3| "add 2 numbers"
1|def multiply(a,b)
2| "multiply 2 numbers"
3| return a * b
4|
5| return a+b
5|def add(a,b):
6| "add 2 numbers"
7| return a + b
>>>>>>> REPLACE
{fence[1]}
The *SEARCH* section must *EXACTLY MATCH* the existing source code, character for character.
The *SEARCH/REPLACE block* must be concise.
Include just enough lines to uniquely specify the change.
Don't include extra unchanging lines.
Every *SEARCH/REPLACE block* must be fenced with {fence[0]} and {fence[1]}, with the correct code language.
Expand All @@ -59,4 +73,7 @@ class EditBlockPrompts(CoderPrompts):
repo_content_prefix = """Below here are summaries of other files!
Do not propose changes to these files, they are *read-only*.
To make a file *read-write*, ask me to *add it to the chat*.
"""
additional_context_prefix = """
Here is some context for our conversation.\n
"""

0 comments on commit 706451d

Please sign in to comment.