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 tool calling for anthropic tools

Kilian Lieret5164382233f8
diff --git a/sweagent/tools/commands.py b/sweagent/tools/commands.py
index 1712b268..0b2e3b7d 100644
--- a/sweagent/tools/commands.py
+++ b/sweagent/tools/commands.py
@@ -60,6 +60,7 @@ class Argument(BaseModel):
name: str
type: str
+ items: dict[str, str] | None = None
description: str
required: bool
enum: list[str] | None = None
@@ -139,6 +140,9 @@ class Command(BaseModel):
for arg in self.arguments:
properties[arg.name] = {"type": arg.type, "description": arg.description}
+ if arg.items:
+ properties[arg.name]["items"] = arg.items
+
if arg.required:
required.append(arg.name)
diff --git a/tools/edit_anthropic/config.yaml b/tools/edit_anthropic/config.yaml
index ce2168c5..2d91f712 100644
--- a/tools/edit_anthropic/config.yaml
+++ b/tools/edit_anthropic/config.yaml
@@ -19,7 +19,9 @@ tools:
required: false
argument_format: "--file_text {value}"
- name: view_range
- type: list
+ type: array
+ items:
+ type: integer
description: "Range of lines to display when evoking `view`. If not provided, the entire file is displayed."
required: false
argument_format: "--view_range {value}"