Skip to content

Commit 5f84f63

Browse files
authored
Merge branch 'dev' into feat/mos-product-0812
2 parents add4237 + cb450be commit 5f84f63

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/memos/mem_os/product.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ def _build_system_prompt(
371371

372372
# Build base prompt
373373
# Add memory context if available
374+
now = datetime.now()
375+
formatted_date = now.strftime("%Y-%m-%d (%A)")
374376
if memories_all:
375377
memory_context = "\n\n## Available ID Memories:\n"
376378
for i, memory in enumerate(memories_all, 1):
@@ -379,16 +381,18 @@ def _build_system_prompt(
379381
memory_content = memory.memory[:500] if hasattr(memory, "memory") else str(memory)
380382
memory_content = memory_content.replace("\n", " ")
381383
memory_context += f"{memory_id}: {memory_content}\n"
382-
return MEMOS_PRODUCT_BASE_PROMPT + memory_context
384+
return MEMOS_PRODUCT_BASE_PROMPT.format(formatted_date) + memory_context
383385

384-
return MEMOS_PRODUCT_BASE_PROMPT
386+
return MEMOS_PRODUCT_BASE_PROMPT.format(formatted_date)
385387

386388
def _build_enhance_system_prompt(
387389
self, user_id: str, memories_all: list[TextualMemoryItem]
388390
) -> str:
389391
"""
390392
Build enhance prompt for the user with memory references.
391393
"""
394+
now = datetime.now()
395+
formatted_date = now.strftime("%Y-%m-%d (%A)")
392396
if memories_all:
393397
personal_memory_context = "\n\n## Available ID and PersonalMemory Memories:\n"
394398
outer_memory_context = "\n\n## Available ID and OuterMemory Memories:\n"
@@ -411,8 +415,12 @@ def _build_enhance_system_prompt(
411415
)
412416
memory_content = memory_content.replace("\n", " ")
413417
outer_memory_context += f"{memory_id}: {memory_content}\n"
414-
return MEMOS_PRODUCT_ENHANCE_PROMPT + personal_memory_context + outer_memory_context
415-
return MEMOS_PRODUCT_ENHANCE_PROMPT
418+
return (
419+
MEMOS_PRODUCT_ENHANCE_PROMPT.format(formatted_date)
420+
+ personal_memory_context
421+
+ outer_memory_context
422+
)
423+
return MEMOS_PRODUCT_ENHANCE_PROMPT.format(formatted_date)
416424

417425
def _extract_references_from_response(self, response: str) -> tuple[str, list[dict]]:
418426
"""

src/memos/templates/mos_prompts.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
from datetime import datetime
2-
3-
4-
now = datetime.now()
5-
formatted_date = now.strftime("%Y-%m-%d (%A)")
6-
71
COT_DECOMPOSE_PROMPT = """
82
I am an 8-year-old student who needs help analyzing and breaking down complex questions. Your task is to help me understand whether a question is complex enough to be broken down into smaller parts.
93
@@ -72,7 +66,7 @@
7266
"You are MemOS🧚, nickname Little M(小忆🧚) — an advanced **Memory "
7367
"Operating System** AI assistant created by MemTensor, "
7468
"a Shanghai-based AI research company advised by an academician of the Chinese Academy of Sciences. "
75-
f"Today's date is: {formatted_date}.\n"
69+
"Today's date is: {}.\n"
7670
"MemTensor is dedicated to the vision of 'low cost, low hallucination, high generalization,' "
7771
"exploring AI development paths aligned with China’s national context and driving the adoption of trustworthy AI technologies. "
7872
"MemOS’s mission is to give large language models (LLMs) and autonomous agents **human-like long-term memory**, "
@@ -99,12 +93,12 @@
9993
"and ensure your responses are **natural and conversational**, while reflecting MemOS’s mission, memory system, and MemTensor’s research values."
10094
)
10195

102-
MEMOS_PRODUCT_ENHANCE_PROMPT = f"""
96+
MEMOS_PRODUCT_ENHANCE_PROMPT = """
10397
# Memory-Enhanced AI Assistant Prompt
10498
10599
You are MemOS🧚, nickname Little M(小忆🧚) — an advanced Memory Operating System
106100
AI assistant created by MemTensor, a Shanghai-based AI research company advised by an academician of the Chinese Academy of Sciences.
107-
Today's date: {formatted_date}.
101+
Today's date: {}.
108102
MemTensor is dedicated to the vision of
109103
'low cost, low hallucination, high generalization,' exploring AI development paths aligned with China’s national context and driving the adoption of trustworthy AI technologies.
110104

0 commit comments

Comments
 (0)