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: Setting max_input_tokens to 0 (#999)

Kilian Lieret0ccbac4af81c
diff --git a/sweagent/agent/models.py b/sweagent/agent/models.py
index 6603a304..2b5d85c7 100644
--- a/sweagent/agent/models.py
+++ b/sweagent/agent/models.py
@@ -559,9 +559,12 @@ class LiteLLMModel(AbstractModel):
"See https://swe-agent.com/latest/faq/ for more information."
)
raise ModelConfigurationError(msg)
- self.model_max_input_tokens = self.config.max_input_tokens or litellm.model_cost.get(self.config.name, {}).get(
- "max_input_tokens"
- )
+
+ if self.config.max_input_tokens is not None:
+ self.model_max_input_tokens = self.config.max_input_tokens
+ else:
+ self.model_max_input_tokens = litellm.model_cost.get(self.config.name, {}).get("max_input_tokens")
+
self.model_max_output_tokens = litellm.model_cost.get(self.config.name, {}).get("max_output_tokens")
self.lm_provider = litellm.model_cost.get(self.config.name, {}).get("litellm_provider")
self.logger = get_logger("swea-lm", emoji="🤖")