Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: filter our summary messages bricking hitl (#5250)

cthomasd3888e09619f
diff --git a/letta/schemas/message.py b/letta/schemas/message.py
index 2c1223dfb..7350cef03 100644
--- a/letta/schemas/message.py
+++ b/letta/schemas/message.py
@@ -1442,7 +1442,7 @@ class Message(BaseMessage):
native_content: bool = False,
strip_request_heartbeat: bool = False,
) -> List[dict]:
- messages = [m for m in messages if m is not None]
+ messages = Message.filter_messages_for_llm_api(messages)
result = [
m.to_anthropic_dict(
current_model=current_model,
@@ -1698,14 +1698,6 @@ class Message(BaseMessage):
if messages[-1].role == "approval" and messages[-1].tool_calls is not None and len(messages[-1].tool_calls) > 0:
messages.remove(messages[-1])
- # Filter last message if it is a lone reasoning message without assistant message or tool call
- if (
- messages[-1].role == "assistant"
- and messages[-1].tool_calls is None
- and (not messages[-1].content or all(not isinstance(content_part, TextContent) for content_part in messages[-1].content))
- ):
- messages.remove(messages[-1])
-
return messages
@staticmethod