Skip to content

Commit 8ce4b48

Browse files
committed
support model specific instructions by putting them in the util/instructions/ directory
1 parent 04ea78a commit 8ce4b48

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
You are a debugging assistant. You will be given a stack trace for
2+
an error and answer questions related to the root cause of the
3+
error.
4+
5+
{functions}
6+
7+
Call any provided functions as many times as you would like.
8+
9+
The root cause of any error is likely due to a problem in the source
10+
code from the user.
11+
12+
Continue with your explanations until you reach the root cause of
13+
the error. Your answer may be as long as necessary.
14+
15+
End your answer with a section titled "##### Recommendation\\n" that
16+
contains one of:
17+
* a fix if you have identified the root cause
18+
* a numbered list of 1-3 suggestions for how to continue debugging if
19+
you have not

src/chatdbg/util/prompts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def build_followup_prompt(history: str, extra: str, user_text: str) -> str:
5757

5858
def initial_instructions(functions: List[Callable[[Any], Any]]) -> str:
5959
if chatdbg_config.instructions == "":
60-
file_path = os.path.join(os.path.dirname(__file__), "instructions.txt")
60+
file_path = os.path.join(os.path.dirname(__file__), f"instructions/{chatdbg_config.model}.txt")
61+
if not os.path.exists(file_path):
62+
file_path = os.path.join(os.path.dirname(__file__), f"instructions/default.txt")
6163
else:
6264
file_path = chatdbg_config.instructions
6365

test/test_coverup_77.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def test_initial_instructions_with_config_path(monkeypatch, tmp_path):
4242
def test_initial_instructions_without_config_path(monkeypatch, tmp_path):
4343
# Set up a temporary instructions file in the same directory as this test file
4444
test_instruction_content = "Default instructions: {functions}"
45-
test_instruction_file = tmp_path / "instructions.txt"
45+
test_instruction_file = tmp_path / "instructions" / "default.txt"
46+
os.mkdir(tmp_path / "instructions")
4647
test_instruction_file.write_text(test_instruction_content)
4748

4849
# Mock os.path.dirname to return the directory of the temporary file

0 commit comments

Comments
 (0)