Skip to content

Commit 4ef2b90

Browse files
committed
feat: improve prompt
1 parent e6bd3f0 commit 4ef2b90

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/mutahunter/core/prompts/system.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
SYSTEM_PROMPT = """
2-
# Context:
32
You are an AI Agent named Mutanthunter, part of the Software Quality Assurance Team. Your task is to mutate the {{language}} code provided to you. You will be provided with the Abstract Syntax Tree (AST) of the source code for contextual understanding. This AST will help you understand the entire source code. Make sure to read the AST before proceeding with the mutation.
43
"""

src/mutahunter/core/prompts/user.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,35 @@
55
```
66
77
## Response
8-
The output must be in JSON format, wrapped in triple backticks (json...), and adhere to the following Pydantic definitions.
8+
The output must be a JSON object equivalent to type $Mutants, according to the following Pydantic definitions:
99
```
1010
class SingleMutant(BaseModel):
11-
type: str = Field(description="The type of the mutation operator.(e.g., Off-by-One Error, Boundary Condition, Arithmetic, Block removal, Relational Operator, etc.)")
11+
function_name: str = Field(description="The name of the function where the mutation was applied.")
12+
type: str = Field(description="The type of the mutation operator.")
1213
description: str = Field(description="Description of the mutation.")
13-
context_before: str = Field(description="Line of code context before the mutation.")
1414
original_line: str = Field(description="The original line of code before mutation.")
1515
mutated_line: str = Field(description="The line of code after mutation, including a comment with the mutation description.")
16-
context_after: str = Field(description="Line of code context after the mutation.")
1716
1817
class Mutants(BaseModel):
1918
changes: List[Change] = Field(description="A list of changes representing the mutants.")
2019
```
2120
21+
## Output
22+
The output must be in JSON format, wrapped in triple backticks (json...), and adhere to the following Pydantic definitions.
23+
```
24+
{
25+
"changes": [
26+
{
27+
'function_name': "divide",
28+
"type": "DivisionByZero",
29+
'description': "Added division by zero check to prevent division by zero error.",
30+
'original_line': " return a / b",
31+
'mutated_line': " if (b == 0) throw new ArithmeticException("Division by zero"); return a / b; // Mutant: Added division by zero check"
32+
}
33+
]
34+
}
35+
```
36+
2237
## Function Block to Mutate
2338
Lines Covered: {{covered_lines}}. Only mutate lines that are covered by execution.
2439
Note that we have manually added line numbers for each line of code. Do not include line numbers in your mutation. Make sure indentation is preserverd when generating mutants.

0 commit comments

Comments
 (0)