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.

chore: handle bytes in `json_helpers.py` (#3229)

Sarah Wooders9a3413e5f638
diff --git a/letta/helpers/json_helpers.py b/letta/helpers/json_helpers.py
index 3a1af4126..45fa3414e 100644
--- a/letta/helpers/json_helpers.py
+++ b/letta/helpers/json_helpers.py
@@ -10,6 +10,8 @@ def json_dumps(data, indent=2):
def safe_serializer(obj):
if isinstance(obj, datetime):
return obj.isoformat()
+ if isinstance(obj, bytes):
+ return obj.decode("utf-8")
raise TypeError(f"Type {type(obj)} not serializable")
return json.dumps(data, indent=indent, default=safe_serializer, ensure_ascii=False)