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 run_traj_to_demo to include replay_config in output
carlosejimenez492404425e88
diff --git a/sweagent/run/run_traj_to_demo.py b/sweagent/run/run_traj_to_demo.pyindex a9ca35a8..355aad1a 100644--- a/sweagent/run/run_traj_to_demo.py+++ b/sweagent/run/run_traj_to_demo.py@@ -60,14 +60,17 @@ def save_demo(data, file, traj_path):def convert_traj_to_action_demo(traj_path: str, output_file: str | Path, include_user: bool = False):with open(traj_path) as file:traj = json.load(file)+ replay_config = traj["replay_config"]- history = traj["history"]- action_traj = list()admissible_roles = {"assistant", "user", "tool"} if include_user else {"assistant"}- for step in history:- if step["role"] in admissible_roles and step.get("agent", "main") in {"main", "primary"}:- action_traj.append({k: v for k, v in step.items() if k in {"content", "role", "tool_calls"}})- save_demo(action_traj, output_file, traj_path)+ filtered_history = [+ {k: v for k, v in step.items() if k in {"content", "role", "tool_calls"}}+ for step in traj["history"]+ if step["role"] in admissible_roles and step.get("agent", "main") in {"main", "primary"}+ ]++ output_data = {"history": filtered_history, "replay_config": replay_config}+ save_demo(output_data, output_file, traj_path)print(f"Saved demo to {output_file}")