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]
Enh: Can load demos from yaml files
Kilian Lieretcc841b391b26
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 1ff31303..6260a773 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -7,6 +7,7 @@ from collections import defaultdictfrom pathlib import Pathfrom typing import Any+import yamlfrom jinja2 import Templatefrom pydantic import BaseModel, ConfigDict, Field, model_validatorfrom simple_parsing.helpers.fields import field@@ -354,9 +355,14 @@ class Agent:# Load historyself.logger.info(f"DEMONSTRATION: {demonstration_path}")- demo_history = json.loads(Path(demonstration_path).read_text())["history"]+ _demo_text = Path(demonstration_path).read_text()+ if demonstration_path.suffix == ".yaml":+ demo_history = yaml.safe_load(_demo_text)["history"]+ else:+ demo_history = json.loads(_demo_text)["history"]if self.templates.put_demos_in_history:+ # Add demonstrations to history step-by-stepfor entry in demo_history:if entry["role"] != "system":entry["is_demo"] = True