Skip to content

Commit c53f936

Browse files
authored
Merge pull request #30 from commit-0/aider
add user custom prompt
2 parents fee7546 + 53184e7 commit c53f936

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

baselines/baseline_utils.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,6 @@ def get_file_info(file_path: Path, prefix: str = "") -> str:
116116
return "\n".join(filter(None, tree_string))
117117

118118

119-
def get_prompt(file_list: str) -> str:
120-
"""Get the prompt for the Aider model."""
121-
return """Here is the Task:\n Your task is to iteratively implement the each function that is 'NotImplementedError('IMPLEMENT ME HERE')' in these files until there are no more 'NotImplementedError('IMPLEMENT ME HERE')' and pass the unit tests.
122-
Make sure you read the files carefully.
123-
Your output should be the edited code files.
124-
Use the above instructions to modify the supplied files: {file_list}
125-
Do not change the names of existing functions or classes, as they may be referenced from other code like unit tests, etc.
126-
Only use standard python libraries, do not suggest installing any packages.
127-
""".format(file_list=file_list)
128-
129-
130119
def get_target_edit_files_cmd_args(target_dir: str) -> str:
131120
"""Find the files with the error 'NotImplementedError('IMPLEMENT ME
132121
HERE')'.
@@ -156,14 +145,7 @@ def get_message_to_aider(
156145
ds: Dict[str, Any],
157146
) -> str:
158147
"""Get the message to Aider."""
159-
# support context for aider
160-
if aider_config.use_user_prompt:
161-
assert (
162-
aider_config.user_prompt != ""
163-
), "You choose to use custom user prompt, but it is empty"
164-
prompt = f"{PROMPT_HEADER} " + aider_config.user_prompt
165-
else:
166-
prompt = f"{PROMPT_HEADER} " + get_prompt(target_edit_files_cmd_args)
148+
prompt = f"{PROMPT_HEADER} " + aider_config.user_prompt
167149

168150
if aider_config.use_unit_tests_info and ds["test"]["test_dir"]:
169151
unit_tests_info = (

baselines/configs/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ commit0_config:
1313
aider_config:
1414
llm_name: "claude-3-5-sonnet-20240620"
1515
use_user_prompt: false
16-
user_prompt: ""
16+
user_prompt: "Here is the Task:\n Your task is to iteratively implement the each function that is 'NotImplementedError('IMPLEMENT ME HERE')' in these files until there are no more 'NotImplementedError('IMPLEMENT ME HERE')' and pass the unit tests.\nMake sure you read the files carefully.\nYour output should be the edited code files.\nUse the above instructions to modify the supplied files.\nDo not change the names of existing functions or classes, as they may be referenced from other code like unit tests, etc.\nOnly use standard python libraries, do not suggest installing any packages."
1717
use_repo_info: false
1818
use_unit_tests_info: false
1919
use_reference_info: false

baselines/run_aider.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def run_aider_for_repo(
108108
else:
109109
lint_cmd = ""
110110

111+
print(
112+
f"Aider logs for {repo_name} can be found in: {RUN_AIDER_LOG_DIR / repo_name / 'ai'}"
113+
)
114+
111115
if aider_config.run_tests:
112116
for test_file in test_files:
113117
test_cmd = f"python -m commit0 test {repo_name} {test_file}"

0 commit comments

Comments
 (0)