Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: Add new tool_calls field to ToolCallMessage [LET-5333] (#5267)
Matthew Zhou45101fd97afb
diff --git a/fern/openapi.json b/fern/openapi.jsonindex d20c3629a..296c1bc5d 100644--- a/fern/openapi.json+++ b/fern/openapi.json@@ -33842,7 +33842,25 @@"$ref": "#/components/schemas/ToolCallDelta"}],- "title": "Tool Call"+ "title": "Tool Call",+ "deprecated": true+ },+ "tool_calls": {+ "anyOf": [+ {+ "items": {+ "$ref": "#/components/schemas/ToolCall"+ },+ "type": "array"+ },+ {+ "$ref": "#/components/schemas/ToolCallDelta"+ },+ {+ "type": "null"+ }+ ],+ "title": "Tool Calls"}},"type": "object",diff --git a/letta/schemas/letta_message.py b/letta/schemas/letta_message.pyindex 2c436b41d..b3bf96e7b 100644--- a/letta/schemas/letta_message.py+++ b/letta/schemas/letta_message.py@@ -190,7 +190,8 @@ class ToolCallMessage(LettaMessage):message_type: Literal[MessageType.tool_call_message] = Field(default=MessageType.tool_call_message, description="The type of the message.")- tool_call: Union[ToolCall, ToolCallDelta]+ tool_call: Union[ToolCall, ToolCallDelta] = Field(..., deprecated=True)+ tool_calls: Optional[Union[List[ToolCall], ToolCallDelta]] = Nonedef model_dump(self, *args, **kwargs):"""@@ -198,8 +199,14 @@ class ToolCallMessage(LettaMessage):"""kwargs["exclude_none"] = Truedata = super().model_dump(*args, **kwargs)- if isinstance(data["tool_call"], dict):+ if isinstance(data.get("tool_call"), dict):data["tool_call"] = {k: v for k, v in data["tool_call"].items() if v is not None}+ if isinstance(data.get("tool_calls"), dict):+ data["tool_calls"] = {k: v for k, v in data["tool_calls"].items() if v is not None}+ elif isinstance(data.get("tool_calls"), list):+ data["tool_calls"] = [+ {k: v for k, v in item.items() if v is not None} if isinstance(item, dict) else item for item in data["tool_calls"]+ ]return dataclass Config: