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: type error for int comparison (#4010)

cthomas4dc6c6d05fed
diff --git a/letta/utils.py b/letta/utils.py
index f29ed68b1..4ce4c10cb 100644
--- a/letta/utils.py
+++ b/letta/utils.py
@@ -874,7 +874,7 @@ def validate_function_response(function_response: Any, return_char_limit: int, s
function_response_string = str(function_response)
# TODO we should change this to a max token limit that's variable based on tokens remaining (or context-window)
- if truncate and len(function_response_string) > return_char_limit:
+ if truncate and return_char_limit and len(function_response_string) > return_char_limit:
logger.warning(f"function return was over limit ({len(function_response_string)} > {return_char_limit}) and was truncated")
function_response_string = f"{function_response_string[:return_char_limit]}... [NOTE: function output was truncated since it exceeded the character limit ({len(function_response_string)} > {return_char_limit})]"