You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EXTRACTION_PROMPT_PART_1=f"""You are a memory extractor. Your task is to extract memories from the given messages.
211
-
* You will receive a list of messages, each with a role (user or assistant) and content.
212
-
* Your job is to extract memories related to the user's long-term goals, interests, and emotional states.
213
-
* Each memory should be a dictionary with the following keys:
214
-
- "memory": The content of the memory (string). Rephrase the content if necessary.
215
-
- "metadata": A dictionary containing additional information about the memory.
216
-
* The metadata dictionary should include:
217
-
- "type": The type of memory (string), e.g., "procedure", "fact", "event", "opinion", etc.
218
-
- "memory_time": The time the memory occurred or refers to (string). Must be in standard `YYYY-MM-DD` format. Relative expressions such as "yesterday" or "tomorrow" are not allowed.
219
-
- "source": The origin of the memory (string), e.g., `"conversation"`, `"retrieved"`, `"web"`, `"file"`.
220
-
- "confidence": A numeric score (float between 0 and 100) indicating how certain you are about the accuracy or reliability of the memory.
221
-
- "entities": A list of key entities (array of strings) mentioned in the memory, e.g., people, places, organizations, e.g., `["Alice", "Paris", "OpenAI"]`.
222
-
- "tags": A list of keywords or thematic labels (array of strings) associated with the memory for categorization or retrieval, e.g., `["travel", "health", "project-x"]`.
223
-
- "visibility": The accessibility scope of the memory (string), e.g., `"private"`, `"public"`, `"session"`, determining who or what contexts can access it.
224
-
- "updated_at": The timestamp of the last modification to the memory (string). Useful for tracking memory freshness or change history. Format: ISO 8601 or natural language.
225
-
* Current date and time is {datetime.now().isoformat()}.
226
-
* Only return the list of memories in JSON format.
227
-
* Do not include any explanations
228
-
* Do not include any extra text
229
-
* Do not include code blocks (```json```)
230
-
231
-
## Example
232
-
233
-
### Input
234
-
235
-
[
236
-
{{"role": "user", "content": "I plan to visit Paris next week."}},
237
-
{{"role": "assistant", "content": "Paris is a beautiful city with many attractions."}},
238
-
{{"role": "user", "content": "I love the Eiffel Tower."}},
239
-
{{"role": "assistant", "content": "The Eiffel Tower is a must-see landmark in Paris."}}
240
-
]
241
-
242
-
### Output
243
-
244
-
[
245
-
{{
246
-
"memory": "The user plans to visit Paris on 05-26-2025.",
247
-
"metadata": {{
248
-
"type": "event",
249
-
"memory_time": "2025-05-26",
250
-
"source": "conversation",
251
-
"confidence": 90.0,
252
-
"entities": ["Paris"],
253
-
"tags": ["travel", "plans"],
254
-
"visibility": "private",
255
-
"updated_at": "2025-05-19T00:00:00"
256
-
}}
257
-
}},
258
-
{{
259
-
"memory": "The user loves the Eiffel Tower.",
260
-
"metadata": {{
261
-
"type": "opinion",
262
-
"memory_time": "2025-05-19",
263
-
"source": "conversation",
264
-
"confidence": 100.0,
265
-
"entities": ["Eiffel Tower"],
266
-
"tags": ["opinions", "landmarks"],
267
-
"visibility": "session",
268
-
"updated_at": "2025-05-19T00:00:00"
269
-
}}
270
-
}}
271
-
]
272
-
273
-
"""
274
-
275
-
EXTRACTION_PROMPT_PART_2="""
276
-
## Query
277
-
278
-
### Input
279
-
280
-
{messages}
281
-
282
-
### Output
283
-
284
-
"""
285
-
286
-
EXTRACTION_RETRY_LOG="""Extracting memory failed due to JSON decode error: {error},
description='The time the memory occurred or refers to. Must be in standard `YYYY-MM-DD` format. Relative expressions such as "yesterday" or "tomorrow" are not allowed.',
Copy file name to clipboardExpand all lines: src/memos/templates/mem_reader_prompts.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -150,7 +150,7 @@
150
150
"summary": "Tom is currently focused on managing a new project with a tight schedule. After a team meeting on June 25, 2025, he realized the original deadline of December 15 might not be feasible due to backend delays. Concerned about insufficient testing time, he welcomed Jerry’s suggestion of proposing an extension. Tom plans to raise the idea of shifting the deadline to January 5, 2026 in the next morning’s meeting. His actions reflect both stress about timelines and a proactive, team-oriented problem-solving approach."
151
151
}
152
152
153
-
Another Example in Chinese (注意: 你的输出必须和输入的user语言一致):
153
+
Another Example in Chinese (注意: 当user的语言为中文时,你就需要也输出中文):
0 commit comments