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: anthropic payload tool parse error LET-5469 (#5388)

cthomas731e314b5d4b
diff --git a/letta/llm_api/anthropic_client.py b/letta/llm_api/anthropic_client.py
index feadb37a5..6d920b5d4 100644
--- a/letta/llm_api/anthropic_client.py
+++ b/letta/llm_api/anthropic_client.py
@@ -585,6 +585,8 @@ class AnthropicClient(LLMClientBase):
# hack for incorrect tool format
tool_input = json.loads(json.dumps(content_part.input))
if "id" in tool_input and tool_input["id"].startswith("toolu_") and "function" in tool_input:
+ if isinstance(tool_input["function"], str):
+ tool_input["function"] = json.loads(tool_input["function"])
arguments = json.dumps(tool_input["function"]["arguments"], indent=2)
try:
args_json = json.loads(arguments)