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]
Minor improvements for models.py
Yeonwoo Sung38f9cf42a6fa
diff --git a/run.py b/run.pyindex 9db90c8d..98f6bc00 100644--- a/run.py+++ b/run.py@@ -189,8 +189,8 @@ def should_open_pr(args: ScriptArguments, info: Dict[str, Any], *, token: str=""return Falseelse:logger.warning(- f"Proceeding with PR creation even though there are already commits "- "({commit_url_strs}) associated with the issue. Please only do this for your own repositories "+ "Proceeding with PR creation even though there are already commits "+ f"({commit_url_strs}) associated with the issue. Please only do this for your own repositories ""or after verifying that the existing commits do not fix the issue.")return Truediff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 48c907ea..01239f11 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -267,7 +267,7 @@ class OpenAIModel(BaseModel):top_p=self.args.top_p,)except BadRequestError as e:- raise CostLimitExceededError(f"Context window ({self.model_metadata['max_context']} tokens) exceeded")+ raise CostLimitExceededError(f"Context window ({self.model_metadata['max_context']} tokens) exceeded") from e# Calculate + update costs, return responseinput_tokens = response.usage.prompt_tokensoutput_tokens = response.usage.completion_tokens@@ -665,7 +665,7 @@ class ReplayModel(BaseModel):def __init__(self, args: ModelArguments, commands: list[Command]):super().__init__(args, commands)- if self.args.replay_path == None or not os.path.exists(self.args.replay_path):+ if self.args.replay_path is None or not os.path.exists(self.args.replay_path):raise ValueError("--replay_path must point to a file that exists to run a replay policy")