Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: have `Message.to_pydantic(...)` set `tool_calls` to `None` if empty (#1695)
Sarah Wooders05159f2cecff
diff --git a/letta/orm/message.py b/letta/orm/message.pyindex dacadd6c1..589bd2d1f 100644--- a/letta/orm/message.py+++ b/letta/orm/message.py@@ -65,6 +65,9 @@ class Message(SqlalchemyBase, OrganizationMixin, AgentMixin):model = self.__pydantic_model__.model_validate(self)if self.text and not model.content:model.content = [PydanticTextContent(text=self.text)]+ # If there are no tool calls, set tool_calls to None+ if len(self.tool_calls) == 0:+ model.tool_calls = Nonereturn model