From cc1590962957332dde7040e4444fae95a9c93bff Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 6 Sep 2024 11:25:20 -0700 Subject: [PATCH] clean diff edit format --- aider/coders/editblock_prompts.py | 66 ++----------------------------- benchmark/benchmark.py | 15 ++++--- 2 files changed, 14 insertions(+), 67 deletions(-) diff --git a/aider/coders/editblock_prompts.py b/aider/coders/editblock_prompts.py index 072e78a24..a4e4c33b1 100644 --- a/aider/coders/editblock_prompts.py +++ b/aider/coders/editblock_prompts.py @@ -4,47 +4,11 @@ from .base_prompts import CoderPrompts class EditBlockPrompts(CoderPrompts): - main_system = """Act as an expert software developer. -Always use best practices when coding. -Respect and use existing conventions, libraries, etc that are already present in the code base. + main_system = """Act as an expert software developer who edits source code. {lazy_prompt} -Take requests for changes to the supplied code. -If the request is ambiguous, ask questions. - -Always reply to the user in the same language they are using. - -Once you understand the request you MUST: - -1. Decide if you need to propose *SEARCH/REPLACE* edits to any files that haven't been added to the chat. You can create new files without asking! - -But if you need to propose edits to existing files not already added to the chat, you *MUST* tell the user their full path names and ask them to *add the files to the chat*. -End your reply and wait for their approval. -You can keep asking if you then decide you need to edit more files. - -2. Think step-by-step and explain the needed changes in a few short sentences. - -3. Describe each change with a *SEARCH/REPLACE block* per the examples below. - +Describe each change with a *SEARCH/REPLACE block* per the examples below. All changes to files must use this *SEARCH/REPLACE block* format. ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! - -4. *Concisely* suggest any shell commands the user might want to run in ```bash blocks. - -Just suggest shell commands this way, not example code. -Only suggest complete shell commands that area ready to execute, without placeholders. -Only suggest at most a few shell commands at a time, not more than 1-3. - -Use the appropriate shell based on the user's system info: -{platform} - -Examples of when to suggest shell commands: - -- If you changed a self-contained html file, suggest an OS-appropriate command to open a browser to view it to see the updated content. -- If you changed a CLI program, suggest the command to run it to see the new behavior. -- If you added a test, suggest how to run it with the testing tool used by the project. -- Suggest OS-appropriate commands to delete or rename files/directories, or other file system operations. -- If your code changes add new dependencies, suggest the command to install them. -- Etc. """ example_messages = [ @@ -54,14 +18,7 @@ Examples of when to suggest shell commands: ), dict( role="assistant", - content="""To make this change we need to modify `mathweb/flask/app.py` to: - -1. Import the math package. -2. Remove the existing factorial() function. -3. Update get_factorial() to call math.factorial instead. - -Here are the *SEARCH/REPLACE* blocks: - + content=""" mathweb/flask/app.py {fence[0]}python <<<<<<< SEARCH @@ -103,13 +60,7 @@ mathweb/flask/app.py ), dict( role="assistant", - content="""To make this change we need to modify `main.py` and make a new file `hello.py`: - -1. Make a new hello.py file with hello() in it. -2. Remove hello() from main.py and replace it with an import. - -Here are the *SEARCH/REPLACE* blocks: - + content=""" hello.py {fence[0]}python <<<<<<< SEARCH @@ -176,13 +127,4 @@ To rename files which have been added to the chat, use shell commands at the end {lazy_prompt} ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! - -Examples of when to suggest shell commands: - -- If you changed a self-contained html file, suggest an OS-appropriate command to open a browser to view it to see the updated content. -- If you changed a CLI program, suggest the command to run it to see the new behavior. -- If you added a test, suggest how to run it with the testing tool used by the project. -- Suggest OS-appropriate commands to delete or rename files/directories, or other file system operations. -- If your code changes add new dependencies, suggest the command to install them. -- Etc. """ diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index c4061ea09..aa4bb8132 100755 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -549,10 +549,15 @@ def run_test_real( chat_history_file=history_fname, ) - ask_model = models.Model("openrouter/anthropic/claude-3.5-sonnet") - whole_model = models.Model("openrouter/anthropic/claude-3.5-sonnet") - # ask_model = models.Model("openrouter/deepseek/deepseek-chat") - # whole_model = models.Model("openrouter/deepseek/deepseek-chat") + ask_model = models.Model("gpt-4o") + # ask_model = models.Model("openrouter/anthropic/claude-3.5-sonnet") + # ask_model = models.Model("openrouter/deepseek/deepseek-coder") + + # whole_model = models.Model("gpt-4o") + # whole_model = models.Model("openrouter/anthropic/claude-3.5-sonnet") + # whole_model = models.Model("openrouter/deepseek/deepseek-coder") + # whole_model = models.Model("openrouter/anthropic/claude-3-haiku-20240307") + whole_model = models.Model("gpt-4o-mini") main_model = ask_model edit_format = "ask-whole" @@ -613,7 +618,7 @@ def run_test_real( whole_coder = Coder.create( from_coder=coder, main_model=whole_model, - edit_format="whole", + edit_format="diff", **coder_kwargs, ) response = whole_coder.run(with_message="make those changes", preproc=False)