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: patch cache bust in the system prompt via timestamp [LET-4155] (#4375)

Charles Packer46672de2d67f
diff --git a/letta/helpers/datetime_helpers.py b/letta/helpers/datetime_helpers.py
index d4e783f82..1c931c00e 100644
--- a/letta/helpers/datetime_helpers.py
+++ b/letta/helpers/datetime_helpers.py
@@ -20,11 +20,13 @@ def datetime_to_timestamp(dt):
def get_local_time_fast(timezone):
# Get current UTC time and convert to the specified timezone
+ # Only return the date to avoid cache busting on every request
if not timezone:
- return datetime.now().strftime("%Y-%m-%d %I:%M:%S %p %Z%z")
+ return datetime.now().strftime("%B %d, %Y")
current_time_utc = datetime.now(pytz.utc)
local_time = current_time_utc.astimezone(pytz.timezone(timezone))
- formatted_time = local_time.strftime("%Y-%m-%d %I:%M:%S %p %Z%z")
+ # Return only the date in a human-readable format (e.g., "June 1, 2021")
+ formatted_time = local_time.strftime("%B %d, %Y")
return formatted_time
diff --git a/letta/prompts/prompt_generator.py b/letta/prompts/prompt_generator.py
index c0e276cab..4930ff26f 100644
--- a/letta/prompts/prompt_generator.py
+++ b/letta/prompts/prompt_generator.py
@@ -52,7 +52,7 @@ class PromptGenerator:
# Create a metadata block of info so the agent knows about the metadata of out-of-context memories
metadata_lines = [
"<memory_metadata>",
- f"- The current time is: {get_local_time_fast(timezone)}",
+ f"- The current system date is: {get_local_time_fast(timezone)}",
f"- Memory blocks were last modified: {timestamp_str}",
f"- {previous_message_count} previous messages between you and the user are stored in recall memory (use tools to access them)",
]