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(models): Handle local LM context length errors
Kilian Liereteee7181942e1
diff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 98061860..c6390d51 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -639,6 +639,10 @@ class LiteLLMModel(AbstractModel):raise ContextWindowExceededError from eexcept litellm.exceptions.ContentPolicyViolationError as e:raise ContentPolicyViolationError from e+ except litellm.exceptions.BadRequestError as e:+ if "is longer than the model's context length" in str(e):+ raise ContextWindowExceededError from e+ raiseself.logger.info(f"Response: {response}")cost = litellm.cost_calculator.completion_cost(response)choices: litellm.types.utils.Choices = response.choices # type: ignore