| 1 | #!/usr/bin/env python3
|
| 2 |
|
| 3 | import json
|
| 4 | import sys
|
| 5 | from pathlib import Path
|
| 6 | from unittest.mock import patch
|
| 7 |
|
| 8 | from minisweagent.models.test_models import DeterministicModel
|
| 9 | from minisweagent.run.extra.github_issue import DEFAULT_CONFIG, main
|
| 10 |
|
| 11 |
|
| 12 | def update_trajectory():
|
| 13 | traj_path = Path(__file__).parent / "github_issue.traj.json"
|
| 14 | trajectory = json.loads(traj_path.read_text())
|
| 15 |
|
| 16 | model_responses = [msg["content"] for msg in trajectory[2:] if msg["role"] == "assistant"]
|
| 17 |
|
| 18 | with patch("minisweagent.run.extra.github_issue.get_model") as mock_get_model:
|
| 19 | mock_get_model.return_value = DeterministicModel(outputs=model_responses)
|
| 20 | github_url = "https://github.com/SWE-agent/test-repo/issues/1"
|
| 21 | agent = main(issue_url=github_url, model="tardis", config=DEFAULT_CONFIG)
|
| 22 |
|
| 23 | traj_path.write_text(json.dumps(agent.messages, indent=2))
|
| 24 |
|
| 25 |
|
| 26 | if __name__ == "__main__":
|
| 27 | update_trajectory()
|