Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: utc for message/passage search tpuf [LET-6109] (#6429)
Ari Webb4d5be22d14f9
diff --git a/letta/helpers/tpuf_client.py b/letta/helpers/tpuf_client.pyindex 38107060a..831adb2d0 100644--- a/letta/helpers/tpuf_client.py+++ b/letta/helpers/tpuf_client.py@@ -688,6 +688,9 @@ class TurbopufferClient:# build date filter conditionsdate_filters = []if start_date:+ # Convert to UTC to match stored timestamps+ if start_date.tzinfo is not None:+ start_date = start_date.astimezone(timezone.utc)date_filters.append(("created_at", "Gte", start_date))if end_date:# if end_date has no time component (is at midnight), adjust to end of day@@ -697,6 +700,9 @@ class TurbopufferClient:# add 1 day and subtract 1 microsecond to get 23:59:59.999999end_date = end_date + timedelta(days=1) - timedelta(microseconds=1)+ # Convert to UTC to match stored timestamps+ if end_date.tzinfo is not None:+ end_date = end_date.astimezone(timezone.utc)date_filters.append(("created_at", "Lte", end_date))# combine all filters@@ -829,6 +835,9 @@ class TurbopufferClient:# build date filter conditionsdate_filters = []if start_date:+ # Convert to UTC to match stored timestamps+ if start_date.tzinfo is not None:+ start_date = start_date.astimezone(timezone.utc)date_filters.append(("created_at", "Gte", start_date))if end_date:# if end_date has no time component (is at midnight), adjust to end of day@@ -838,6 +847,9 @@ class TurbopufferClient:# add 1 day and subtract 1 microsecond to get 23:59:59.999999end_date = end_date + timedelta(days=1) - timedelta(microseconds=1)+ # Convert to UTC to match stored timestamps+ if end_date.tzinfo is not None:+ end_date = end_date.astimezone(timezone.utc)date_filters.append(("created_at", "Lte", end_date))# build project_id filter if provided@@ -988,6 +1000,9 @@ class TurbopufferClient:# date filtersif start_date:+ # Convert to UTC to match stored timestamps+ if start_date.tzinfo is not None:+ start_date = start_date.astimezone(timezone.utc)all_filters.append(("created_at", "Gte", start_date))if end_date:# make end_date inclusive of the entire day@@ -995,6 +1010,9 @@ class TurbopufferClient:from datetime import timedeltaend_date = end_date + timedelta(days=1) - timedelta(microseconds=1)+ # Convert to UTC to match stored timestamps+ if end_date.tzinfo is not None:+ end_date = end_date.astimezone(timezone.utc)all_filters.append(("created_at", "Lte", end_date))# combine filters