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: completion_kwargs not defined for model != anthropic

Kilian Lieretb4a54c0b5560
diff --git a/sweagent/agent/models.py b/sweagent/agent/models.py
index c452d592..c4eea1ca 100644
--- a/sweagent/agent/models.py
+++ b/sweagent/agent/models.py
@@ -363,8 +363,9 @@ class LiteLLMModel(AbstractModel):
if self.tools.use_function_calling:
extra_args["tools"] = self.tools.tools
# We need to always set max_tokens for anthropic models
+ completion_kwargs = self.args.completion_kwargs
if self.lm_provider == "anthropic":
- completion_kwargs = {**self.args.completion_kwargs, "max_tokens": self.model_max_output_tokens}
+ completion_kwargs["max_tokens"] = self.model_max_output_tokens
response: litellm.types.utils.ModelResponse = litellm.completion( # type: ignore
model=self.args.name,
messages=messages,