Skip to content

Commit 1310628

Browse files
committed
Update prompts & add spec to context
1 parent 245400d commit 1310628

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

agent/agents.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from aider.io import InputOutput
99
import re
1010
import os
11+
import bz2
1112

1213

1314
def handle_logging(logging_name: str, log_file: Path) -> None:
@@ -108,6 +109,11 @@ def run_manager(
108109
# Configure httpx and backoff logging
109110
handle_logging("httpx", log_file)
110111
handle_logging("backoff", log_file)
112+
113+
# Get the specifications
114+
with bz2.open("spec.pdf.bz2", "rb") as in_file:
115+
with open("spec.pdf", "wb") as out_file:
116+
out_file.write(in_file.read())
111117

112118
io = InputOutput(
113119
yes=False,
@@ -117,7 +123,7 @@ def run_manager(
117123
manager = Coder.create(
118124
edit_format="ask",
119125
main_model=self.model,
120-
read_only_fnames=fnames,
126+
read_only_fnames=fnames + ["spec.pdf"],
121127
io=io,
122128
)
123129
manager.max_reflection = self.max_iteration

agent/run_agent.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,18 +346,18 @@ def run_team_for_repo(
346346
yaml.dump(agent_config, agent_config_file)
347347

348348
# /ask will make aider not write any code, but only a plan
349-
manager_message = f"""You are a manager in charge of writing a plan to complete the implementations for all functions (i.e., those with pass statements) and pass the unit tests. Write a concise plan of attack to implement the entire repo, but don't actually do any coding. Please output the plan in the format of a list of numbered steps. Each step should specify a file to edit and a high-level description of the change to make. Note that we only need to edit the files that contain functions with pass statements, ie. those in the current context. Give me only the plan, with no extraneous text.
349+
manager_message = f"""You are a manager in charge of writing a plan to complete the implementations for all functions (i.e., those with pass statements) and pass the unit tests. Write a plan of attack to implement the entire repo, keeping in mind the most effective order in which tasks should be implemented. Please output the plan in the format of a list of numbered steps. Each step should specify a file to edit and a high-level description of the change to make. Note that we only need to edit the files that contain functions with pass statements, ie. those in the current context. Give me ONLY the plan, with no extraneous text.
350350
351-
You MUST precede the plan with the keyword PLAN_START, and end it with the keyword PLAN_END. You MUST follow the formatting of the example plan below, with a number preceding each step on a new line, and one file name followed by a colon and a description of the change to make:
351+
You MUST precede the plan with the keyword PLAN_START, and end it with the keyword PLAN_END. You MUST follow the formatting of the example plan below, with a number preceding each step on a new line, and one file name followed by a colon and a detailed description of the change to make:
352352
353353
PLAN_START
354-
1.) example_file.py: description of function(s) to implement in example_file.py
355-
2.) example_file2.py: description of function(s) to implement in example_file2.py
354+
1.) example_file.py: description of function(s) to implement in example_file.py, including any relevant context or dependencies
355+
2.) example_file2.py: description of function(s) to implement in example_file2.py, including any relevant context or dependencies
356356
...
357357
PLAN_END
358358
359359
Remember that you must modify all of the target edit files: {target_edit_files}
360-
The plan does not neccessarily need to edit the whole file in one step, and it may be more granular as you see fit.
360+
The plan does not neccessarily need to edit the whole file in one step, and it may be more granular as you see fit. Additionally, you should look at the file 'spec.pdf' for more information on the project requirements and specifications.
361361
"""
362362

363363
with DirContext(repo_path):
@@ -400,7 +400,7 @@ def run_team_for_repo(
400400
for file_name, description in tasks:
401401
update_queue.put(("set_current_file", (repo_name, file_name)))
402402

403-
coder_message = f"Complete the following task, implementing the relevant incomplete functions (i.e., those with pass statements): \n{description}"
403+
coder_message = f"Complete the following task, implementing the relevant incomplete function(s) (i.e., those with pass statements): \n{description}"
404404

405405
agent_return = coder.run(coder_message, "", lint_cmd, [file_name], file_log_dir)
406406

0 commit comments

Comments
 (0)