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: Don't pass None tool_calls to the OpenAI API (#967)
Robin Nabel24ba49cd53ef
diff --git a/sweagent/agent/models.py b/sweagent/agent/models.pyindex 5aa4f069..593b1ab1 100644--- a/sweagent/agent/models.py+++ b/sweagent/agent/models.py@@ -751,8 +751,8 @@ class LiteLLMModel(AbstractModel):# Only one tool call per observations"tool_call_id": history_item["tool_call_ids"][0], # type: ignore}- elif "tool_calls" in history_item:- message = {"role": role, "content": history_item["content"], "tool_calls": history_item["tool_calls"]}+ elif (tool_calls := history_item.get("tool_calls")) is not None:+ message = {"role": role, "content": history_item["content"], "tool_calls": tool_calls}else:message = {"role": role, "content": history_item["content"]}if "cache_control" in history_item: