From 71fcbbc86398f64449040d5246ddd0c3a10b4c3b Mon Sep 17 00:00:00 2001 From: Andy Li <55300002+cliandy@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:11:56 -0700 Subject: [PATCH] fix: unpacking non json values (#2684) --- letta/system.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/letta/system.py b/letta/system.py index dd9cae78..05b83c08 100644 --- a/letta/system.py +++ b/letta/system.py @@ -218,11 +218,13 @@ def get_token_limit_warning(): return json_dumps(packaged_message) -def unpack_message(packed_message) -> str: +def unpack_message(packed_message: str) -> str: """Take a packed message string and attempt to extract the inner message content""" try: message_json = json.loads(packed_message) + if type(message_json) is not dict: + return packed_message except: return packed_message