Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Fix(reviewer): Accept leading minus sign

Kilian Lieret1cf12a1c09a1
diff --git a/sweagent/agent/reviewer.py b/sweagent/agent/reviewer.py
index 8a6ed2a1..7ecceb28 100644
--- a/sweagent/agent/reviewer.py
+++ b/sweagent/agent/reviewer.py
@@ -211,7 +211,7 @@ class Reviewer(AbstractReviewer):
def interpret(self, response: str) -> bool | float:
last_line = response.strip().split("\n")[-1].strip()
# Find all numbers in the last line and take the last one
- numbers = re.findall(r"\d+\.?\d*", last_line)
+ numbers = re.findall(r"-?\d+\.?\d*", last_line)
if not numbers:
msg = f"Could not interpret response: {last_line!r}"
raise ValueError(msg)