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]

Update parsing error messages

carlosejimenezdc523669afce
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index e21a3379..b055e938 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -578,6 +578,7 @@ class Agent:
except Exception as e:
# Attach the step object to the exception
e.step = step # type: ignore
+ self.logger.exception("Error in forward", exc_info=e)
raise
def forward_with_handling(self, history: list[dict[str, str]]) -> StepOutput:
diff --git a/sweagent/tools/parsing.py b/sweagent/tools/parsing.py
index 5c6dafbe..4fcdbf89 100644
--- a/sweagent/tools/parsing.py
+++ b/sweagent/tools/parsing.py
@@ -229,6 +229,8 @@ class FunctionCallingParser(AbstractParseFunction, BaseModel):
Please make sure your output includes a thought and exactly _ONE_ tool call.
Make sure your tool call doesn't include any extra arguments that are not in the allowed arguments, and only use the allowed commands.
+
+ You must invoke the tool directly using the function call format.
"""
type: Literal["function_calling"] = "function_calling"
@@ -273,7 +275,10 @@ class FunctionCallingParser(AbstractParseFunction, BaseModel):
tool_calls = model_response.get("tool_calls", None)
if tool_calls is None or len(tool_calls) != 1:
num_tools = len(tool_calls) if tool_calls else 0
- msg = f"Expected exactly one tool call in model response - received {num_tools} tool calls."
+ msg = (
+ f"Expected exactly one tool call in model response - received {num_tools} "
+ f"tool calls with message: {message}"
+ )
raise FormatError(msg)
tool_call = tool_calls[0]
action = self._parse_tool_call(tool_call, commands)