Skip to content

Commit 3c55c6b

Browse files
committed
fix(memory): enforce sqlite payload size limit
1 parent 8bd8c13 commit 3c55c6b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/google/adk/memory/sqlite_memory_service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,11 @@ def _enforce_max_bytes(
463463
for item in (session_json, search_text, extracted_json, metadata_json):
464464
if item:
465465
total_bytes += len(item.encode("utf-8"))
466-
raise ValueError(f"Session payload is too large ({total_bytes} bytes), exceeding the limit of {max_bytes} bytes.")
466+
if total_bytes > max_bytes:
467+
raise ValueError(
468+
f"Session payload is too large ({total_bytes} bytes), exceeding the"
469+
f" limit of {max_bytes} bytes."
470+
)
467471

468472

469473
def _build_raw_text(events: list[Event]) -> str:

0 commit comments

Comments
 (0)