Skip to content

Commit 0393084

Browse files
authored
fix: patch cache bust in the system prompt via timestamp [LET-4155] (#4375)
fix: patch cache bust in the system prompt via timestamp
1 parent ad5581e commit 0393084

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

letta/helpers/datetime_helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ def datetime_to_timestamp(dt):
2020

2121
def get_local_time_fast(timezone):
2222
# Get current UTC time and convert to the specified timezone
23+
# Only return the date to avoid cache busting on every request
2324
if not timezone:
24-
return datetime.now().strftime("%Y-%m-%d %I:%M:%S %p %Z%z")
25+
return datetime.now().strftime("%B %d, %Y")
2526
current_time_utc = datetime.now(pytz.utc)
2627
local_time = current_time_utc.astimezone(pytz.timezone(timezone))
27-
formatted_time = local_time.strftime("%Y-%m-%d %I:%M:%S %p %Z%z")
28+
# Return only the date in a human-readable format (e.g., "June 1, 2021")
29+
formatted_time = local_time.strftime("%B %d, %Y")
2830

2931
return formatted_time
3032

letta/prompts/prompt_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def compile_memory_metadata_block(
5252
# Create a metadata block of info so the agent knows about the metadata of out-of-context memories
5353
metadata_lines = [
5454
"<memory_metadata>",
55-
f"- The current time is: {get_local_time_fast(timezone)}",
55+
f"- The current system date is: {get_local_time_fast(timezone)}",
5656
f"- Memory blocks were last modified: {timestamp_str}",
5757
f"- {previous_message_count} previous messages between you and the user are stored in recall memory (use tools to access them)",
5858
]

0 commit comments

Comments
 (0)