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]
Ref(models): Pull thinking blocks out of if clause (#1266)
Kilian Lieretd6aedd1444b5
diff --git a/config/default.yaml b/config/default.yamlindex fb792081..dae24349 100644--- a/config/default.yaml+++ b/config/default.yaml@@ -67,3 +67,7 @@ agent:history_processors:- type: cache_controllast_n_messages: 2+ model:+ temperature: 1.+ completion_kwargs:+ reasoning_effort: 'high'diff --git a/docs/config/models.md b/docs/config/models.mdindex 7536bd20..dd1aff0e 100644--- a/docs/config/models.md+++ b/docs/config/models.md@@ -58,6 +58,17 @@ for omore information.Since [#1036](https://github.com/SWE-agent/SWE-agent/pull/1036) you can also manually set the maximum output tokens and override the informationfrom `litellm`.+To use extended thinking, you can set the following in your config:++```yaml+agent:+ name: 'claude-sonnet-4-20250514'+ model:+ temperature: 1.+ completion_kwargs:+ reasoning_effort: 'high'+```+### o1Make sure to setdiff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 3f8369c3..8b2fd183 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -761,14 +761,14 @@ class LiteLLMModel(AbstractModel):if self.tools.use_function_calling:if response.choices[i].message.tool_calls: # type: ignoretool_calls = [call.to_dict() for call in response.choices[i].message.tool_calls] # type: ignore- if (- hasattr(response.choices[i].message, "thinking_blocks")- and response.choices[i].message.thinking_blocks- ): # type: ignore- output_dict["thinking_blocks"] = response.choices[i].message.thinking_blocks # type: ignoreelse:tool_calls = []output_dict["tool_calls"] = tool_calls+ if (+ hasattr(response.choices[i].message, "thinking_blocks") # type: ignore+ and response.choices[i].message.thinking_blocks # type: ignore+ ):+ output_dict["thinking_blocks"] = response.choices[i].message.thinking_blocks # type: ignoreoutputs.append(output_dict)self._update_stats(input_tokens=input_tokens, output_tokens=output_tokens, cost=cost)return outputs