Skip to content

Commit

Permalink
feat: add failing tests in instruct prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
andre15silva committed Sep 2, 2024
1 parent e1b6602 commit 0382dd1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions elleelleaime/sample/strategies/instruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ def instruct(
if len(failing_test_causes) == 0 or len(failing_test_cases) == 0:
return None, None, None

# TODO: use all
test_case = list(failing_test_cases.keys())[0]
failing_tests_string = ""
for test_case in failing_test_cases.keys():
failing_tests_string += f"""Test `{test_case}`:
```java
{failing_test_cases[test_case]}
```
Test `{test_case}` error:
```
{failing_test_causes[test_case]}
```
"""

prompt = f"""You are an automatic program repair tool. Your task is to fix the provided buggy code.
Expand All @@ -49,17 +59,10 @@ def instruct(
{buggy_code}
```
The code fails the following test:
```java
{failing_test_cases[test_case]}
```
With the following test error:
```
{failing_test_causes[test_case]}
```
The code fails the following tests.
Please provide a fixed version of the buggy function, and only that function:
{failing_tests_string}
Please provide a fixed version of the buggy function, and only that function, inside a code block.
"""

return buggy_code, fixed_code, prompt
Expand Down

0 comments on commit 0382dd1

Please sign in to comment.