The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
fix: is readable - zero division error (#383)
cachho65011a67d451
diff --git a/embedchain/utils.py b/embedchain/utils.pyindex d0a7c1e18..6ca2b9df4 100644--- a/embedchain/utils.py+++ b/embedchain/utils.py@@ -1,3 +1,4 @@+import loggingimport reimport string@@ -43,7 +44,11 @@ def is_readable(s)::param s: string:return: True if the string is more than 95% printable."""- printable_ratio = sum(c in string.printable for c in s) / len(s)+ try:+ printable_ratio = sum(c in string.printable for c in s) / len(s)+ except ZeroDivisionError:+ logging.warning("Empty string processed as unreadable")+ printable_ratio = 0return printable_ratio > 0.95 # 95% of characters are printable