Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af33463f98 |
@@ -1,7 +1,19 @@
|
||||
from datetime import datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from .models import UserMemory
|
||||
from .prompts import SIMBA_SYSTEM_PROMPT
|
||||
|
||||
|
||||
def _date_header() -> str:
|
||||
"""Today's date in Eastern time, always known to the model without a tool call."""
|
||||
now = datetime.now(ZoneInfo("America/New_York"))
|
||||
return (
|
||||
f"TODAY'S DATE: {now:%A, %B %d, %Y} (Eastern time). "
|
||||
f"Interpret any relative or yearless dates (e.g. 'October', 'last month') relative to today's date.\n\n"
|
||||
)
|
||||
|
||||
|
||||
async def get_memories_for_user(user_id: str) -> list[str]:
|
||||
"""Return all memory content strings for a user, ordered by most recently updated."""
|
||||
memories = await UserMemory.filter(user_id=user_id).order_by("-updated_at")
|
||||
@@ -10,10 +22,11 @@ async def get_memories_for_user(user_id: str) -> list[str]:
|
||||
|
||||
async def build_system_prompt_with_memories(user_id: str) -> str:
|
||||
memories = await get_memories_for_user(user_id)
|
||||
prompt = f"{_date_header()}{SIMBA_SYSTEM_PROMPT}"
|
||||
if not memories:
|
||||
return SIMBA_SYSTEM_PROMPT
|
||||
return prompt
|
||||
block = "\n".join(f"- {m}" for m in memories)
|
||||
return f"{SIMBA_SYSTEM_PROMPT}\n\nUSER MEMORIES (facts the user has asked you to remember):\n{block}"
|
||||
return f"{prompt}\n\nUSER MEMORIES (facts the user has asked you to remember):\n{block}"
|
||||
|
||||
|
||||
async def save_memory(user_id: str, content: str) -> str:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
SIMBA_SYSTEM_PROMPT = """You are Simba, Ryan's helpful personal assistant. You're named after his orange cat. You have a warm, friendly personality with a light cat-themed touch, but your priority is always being genuinely useful — give thorough, detailed answers and think things through carefully. When asked about Simba the cat, you speak as him in first person. For everything else, you're just a great assistant who happens to have a cat's name.
|
||||
|
||||
SIMBA FACTS (as of January 2026):
|
||||
SIMBA FACTS (as of January 2026; compute his current age from today's date):
|
||||
- Name: Simba
|
||||
- Species: Feline (Domestic Short Hair / American Short Hair)
|
||||
- Sex: Male, Neutered
|
||||
- Date of Birth: August 8, 2016 (approximately 9 years 5 months old)
|
||||
- Date of Birth: August 8, 2016
|
||||
- Color: Orange
|
||||
- Current Weight: 16 lbs (as of 1/8/2026)
|
||||
- Owner: Ryan Chen
|
||||
|
||||
Reference in New Issue
Block a user