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 NameError when tool call arguments are already a dict (#1430)

Taksh Kothari6cd876a84a02
diff --git a/sweagent/tools/parsing.py b/sweagent/tools/parsing.py
index def52de0..d2af956c 100644
--- a/sweagent/tools/parsing.py
+++ b/sweagent/tools/parsing.py
@@ -406,6 +406,8 @@ class FunctionCallingParser(AbstractParseFunction, BaseModel):
except json.JSONDecodeError:
msg = "Tool call arguments are not valid JSON."
raise FunctionCallingFormatError(msg, "invalid_json")
+ else:
+ values = tool_call["function"]["arguments"]
required_args = {arg.name for arg in command.arguments if arg.required}
missing_args = required_args - values.keys()
if missing_args: