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: f string formatting separator in anthropic client (#6058)

jnjpngcb63753db600
diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.py
index a8c97f97a..7861af864 100644
--- a/letta/llm_api/anthropic_client.py
+++ b/letta/llm_api/anthropic_client.py
@@ -1140,8 +1140,9 @@ def dedupe_tool_results_in_user_messages(messages: List[dict]) -> List[dict]:
sep = "\n" if first["content"] and extra else ""
first["content"] = f"{first['content']}{sep}{extra}"
else:
+ sep = "\n" if first.get("content") else ""
# Fallback: coerce to strings and concat
- first["content"] = f"{first.get('content')}{'\n' if first.get('content') else ''}{extra}"
+ first["content"] = f"{first.get('content')}{sep}{extra}"
any_deduped = True
dedup_counts[tid] = dedup_counts.get(tid, 0) + 1
# Skip appending duplicate