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: convert_system_to_user

Kilian Lieret4dcf4e5f338a
diff --git a/sweagent/agent/models.py b/sweagent/agent/models.py
index 873bc909..8bb7e3ad 100644
--- a/sweagent/agent/models.py
+++ b/sweagent/agent/models.py
@@ -360,7 +360,16 @@ class LiteLLMModel(AbstractModel):
wait=wait_random_exponential(min=self.args.retry.min_wait, max=self.args.retry.max_wait),
reraise=True,
retry=retry_if_not_exception_type(
- (CostLimitExceededError, RuntimeError, litellm.exceptions.UnsupportedParamsError)
+ (
+ CostLimitExceededError,
+ RuntimeError,
+ litellm.exceptions.UnsupportedParamsError,
+ litellm.exceptions.NotFoundError,
+ litellm.exceptions.PermissionDeniedError,
+ litellm.exceptions.ContextWindowExceededError,
+ litellm.exceptions.ContentPolicyViolationError,
+ litellm.exceptions.APIError,
+ )
),
):
with attempt:
@@ -376,7 +385,7 @@ class LiteLLMModel(AbstractModel):
return "user" if self.args.convert_system_to_user else "system"
return history_item["role"]
- return [{"role": history_item["role"], "content": history_item["content"]} for history_item in history]
+ return [{"role": get_role(history_item), "content": history_item["content"]} for history_item in history]
def get_model(args: ModelConfig, commands: list[Command] | None = None) -> AbstractModel: