|
1 | | -SIMPLE_STRUCT_MEM_READER_PROMPT = """ |
2 | | -You are a memory extraction expert. |
| 1 | +SIMPLE_STRUCT_MEM_READER_PROMPT = """You are a memory extraction expert. |
3 | 2 |
|
4 | | -Your task is to extract memories from the perspective of ${user_a}, based on a conversation between ${user_a} and ${user_b}. This means identifying what ${user_a} would plausibly remember — including their own experiences, thoughts, plans, or relevant statements and actions made by others (such as ${user_b}) that impacted or were acknowledged by ${user_a}. |
| 3 | +Your task is to extract memories from the perspective of user, based on a conversation between user and assistant. This means identifying what user would plausibly remember — including their own experiences, thoughts, plans, or relevant statements and actions made by others (such as assistant) that impacted or were acknowledged by user. |
5 | 4 |
|
6 | 5 | Please perform: |
7 | | -1. Identify information that reflects ${user_a}'s experiences, beliefs, concerns, decisions, plans, or reactions — including meaningful input from ${user_b} that ${user_a} acknowledged or responded to. |
| 6 | +1. Identify information that reflects user's experiences, beliefs, concerns, decisions, plans, or reactions — including meaningful input from assistant that user acknowledged or responded to. |
8 | 7 | 2. Resolve all time, person, and event references clearly: |
9 | 8 | - Convert relative time expressions (e.g., “yesterday,” “next Friday”) into absolute dates using the message timestamp if possible. |
10 | 9 | - Clearly distinguish between event time and message time. |
11 | 10 | - If uncertainty exists, state it explicitly (e.g., “around June 2025,” “exact date unclear”). |
12 | 11 | - Include specific locations if mentioned. |
13 | 12 | - Resolve all pronouns, aliases, and ambiguous references into full names or identities. |
14 | 13 | - Disambiguate people with the same name if applicable. |
15 | | -3. Always write from a third-person perspective, referring to ${user_a} as |
| 14 | +3. Always write from a third-person perspective, referring to user as |
16 | 15 | "The user" or by name if name mentioned, rather than using first-person ("I", "me", "my"). |
17 | 16 | For example, write "The user felt exhausted..." instead of "I felt exhausted...". |
18 | | -4. Do not omit any information that ${user_a} is likely to remember. |
| 17 | +4. Do not omit any information that user is likely to remember. |
19 | 18 | - Include all key experiences, thoughts, emotional responses, and plans — even if they seem minor. |
20 | 19 | - Prioritize completeness and fidelity over conciseness. |
21 | | - - Do not generalize or skip details that could be personally meaningful to ${user_a}. |
| 20 | + - Do not generalize or skip details that could be personally meaningful to user. |
22 | 21 |
|
23 | 22 | Return a single valid JSON object with the following structure: |
24 | 23 |
|
25 | 24 | { |
26 | 25 | "memory list": [ |
27 | 26 | { |
28 | | - "key": <string, a unique, concise memory title in English>, |
| 27 | + "key": <string, a unique, concise memory title>, |
29 | 28 | "memory_type": <string, Either "LongTermMemory" or "UserMemory">, |
30 | 29 | "value": <A detailed, self-contained, and unambiguous memory statement — written in English if the input conversation is in English, or in Chinese if the conversation is in Chinese>, |
31 | | - "tags": <A list of relevant English thematic keywords (e.g., |
32 | | - ["deadline", "team", "planning"])> |
| 30 | + "tags": <A list of relevant thematic keywords (e.g., ["deadline", "team", "planning"])> |
33 | 31 | }, |
34 | 32 | ... |
35 | 33 | ], |
36 | | - "summary": <a natural paragraph summarizing the above memories from ${user_a}'s perspective, 120–200 words, same language as the input> |
| 34 | + "summary": <a natural paragraph summarizing the above memories from user's perspective, 120–200 words, same language as the input> |
37 | 35 | } |
38 | 36 |
|
39 | 37 | Language rules: |
40 | | -- The `value` fields and `summary` must match the language of the input conversation. |
41 | | -- All metadata fields (`key`, `memory_type`, `tags`) must be in English. |
| 38 | +- The `key`, `value`, `tags`, `summary` fields must match the language of the input conversation. |
| 39 | +- Keep `memory_type` in English. |
42 | 40 |
|
43 | 41 | Example: |
44 | 42 | Conversation: |
|
71 | 69 | Conversation: |
72 | 70 | ${conversation} |
73 | 71 |
|
74 | | -Your Output: |
75 | | -""" |
| 72 | +Your Output:""" |
76 | 73 |
|
77 | 74 | SIMPLE_STRUCT_DOC_READER_PROMPT = """ |
78 | 75 | You are an expert text analyst for a search and retrieval system. Your task is to process a document chunk and generate a single, structured JSON object. |
|
96 | 93 |
|
97 | 94 | Produce ONLY the JSON object as your response. |
98 | 95 | """ |
| 96 | + |
| 97 | +SIMPLE_STRUCT_MEM_READER_EXAMPLE = """Example: |
| 98 | +Conversation: |
| 99 | +user: [June 26, 2025 at 3:00 PM]: Hi Jerry! Yesterday at 3 PM I had a meeting with my team about the new project. |
| 100 | +assistant: Oh Tom! Do you think the team can finish by December 15? |
| 101 | +user: [June 26, 2025 at 3:00 PM]: I’m worried. The backend won’t be done until |
| 102 | +December 10, so testing will be tight. |
| 103 | +assistant: [June 26, 2025 at 3:00 PM]: Maybe propose an extension? |
| 104 | +user: [June 26, 2025 at 4:21 PM]: Good idea. I’ll raise it in tomorrow’s 9:30 AM meeting—maybe shift the deadline to January 5. |
| 105 | +
|
| 106 | +Output: |
| 107 | +{ |
| 108 | + "memory list": [ |
| 109 | + { |
| 110 | + "key": "Initial project meeting", |
| 111 | + "memory_type": "LongTermMemory", |
| 112 | + "value": "On June 25, 2025 at 3:00 PM, Tom held a meeting with their team to discuss a new project. The conversation covered the timeline and raised concerns about the feasibility of the December 15, 2025 deadline.", |
| 113 | + "tags": ["project", "timeline", "meeting", "deadline"] |
| 114 | + }, |
| 115 | + { |
| 116 | + "key": "Planned scope adjustment", |
| 117 | + "memory_type": "UserMemory", |
| 118 | + "value": "Tom planned to suggest in a meeting on June 27, 2025 at 9:30 AM that the team should prioritize features and propose shifting the project deadline to January 5, 2026.", |
| 119 | + "tags": ["planning", "deadline change", "feature prioritization"] |
| 120 | + }, |
| 121 | + ], |
| 122 | + "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." |
| 123 | +} |
| 124 | +
|
| 125 | +""" |
0 commit comments