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.

band aid, error instead of send to anthropic [LET-5478] (#5396)

Ari Webb8ab2cf258c45
diff --git a/letta/schemas/message.py b/letta/schemas/message.py
index 7be48d0ac..051040e62 100644
--- a/letta/schemas/message.py
+++ b/letta/schemas/message.py
@@ -1490,6 +1490,8 @@ class Message(BaseMessage):
# NOTE: Anthropic uses role "user" for "tool" responses
content = []
for tool_return in self.tool_returns:
+ if not tool_return.tool_call_id:
+ raise TypeError("Anthropic API requires tool_use_id to be set.")
content.append(
{
"type": "tool_result",
@@ -1503,6 +1505,8 @@ class Message(BaseMessage):
"content": content,
}
else:
+ if not self.tool_call_id:
+ raise TypeError("Anthropic API requires tool_use_id to be set.")
# This is for legacy reasons
anthropic_message = {
"role": "user", # NOTE: diff