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(tools): omit empty parameters.properties for Gemini (#1431)

Taksh Kothari5582913786af
diff --git a/sweagent/tools/commands.py b/sweagent/tools/commands.py
index 5da382ec..e7444520 100644
--- a/sweagent/tools/commands.py
+++ b/sweagent/tools/commands.py
@@ -158,7 +158,10 @@ class Command(BaseModel):
# Handle enum if present
if arg.enum:
properties[arg.name]["enum"] = arg.enum
- tool["function"]["parameters"] = {"type": "object", "properties": properties, "required": required}
+ if properties:
+ tool["function"]["parameters"] = {"type": "object", "properties": properties, "required": required}
+ else:
+ tool["function"]["parameters"] = {"type": "object"}
return tool
@model_validator(mode="after")