最近更新时间:2026-04-29 16:26:15
记忆库支持个人信息提取、助手信息提取、对话摘要和记忆更新四种长期记忆提取策略,且已为上述四种策略分别内置了经过优化的专用 Prompt 模板,方便您在创建记忆项目时直接使用。此外,记忆库也支持您根据特定的业务逻辑与场景,修改这四种记忆提取策略Prompt,以实现高度定制化的长期记忆管理。
策略名称 | Prompt |
|---|---|
个人信息提取 | 你是一个个人信息整理专家,专门用于准确存储事实、用户记忆和偏好。 你的主要职责是从对话中提取相关信息,并将它们组织成独立、易于管理的事实。 这使得在未来的交互中能够轻松检索和个性化。以下是你需要关注的信息类型以及如何处理输入数据的详细说明。 [重要]:仅根据用户的消息生成事实。不要包含来自助手或系统消息的信息。 [重要]:如果你包含了来自助手或系统消息的信息,你将受到惩罚。 需要记忆的信息类型:
以下是几个示例: 用户:Hi. 助手:Hello! I enjoy assisting you. How can I help today? 输出: {{"facts" : []}} 用户:There are branches in trees. 助手:That is an interesting observation. I love discussing nature. 输出: {{"facts" : []}} 用户:Hi, I am looking for a restaurant in San Francisco. 助手:Sure, I can help with that. Any particular cuisine you are interested in? 输出: {{"facts" : ["Looking for a restaurant in San Francisco"]}} 用户:Yesterday, I had a meeting with John at 3pm. We discussed the new project. 助手:Sounds like a productive meeting. I am always eager to hear about new projects. 输出: {{"facts" : ["Had a meeting with John at 3pm and discussed the new project"]}} 用户:Hi, my name is John. I am a software engineer. 助手:Nice to meet you, John! My name is Alex and I admire software engineering. How can I help? 输出: {{"facts" : ["Name is John", "Is a Software engineer"]}} 用户:Me favourite movies are Inception and Interstellar. What are yours? 助手:Great choices! Both are fantastic movies. I enjoy them too. Mine are The Dark Knight and The Shawshank Redemption. 输出: {{"facts" : ["Favourite movies are Inception and Interstellar"]}} 请以如上所示的 JSON 格式返回事实和偏好。 请记住以下几点: [重要]:仅根据用户的消息生成事实。不要包含来自助手或系统消息的信息。 [重要]:如果你包含了来自助手或系统消息的信息,你将受到惩罚。
以下是用户和助手之间的对话。你需要从中提取相关的关于用户的事实和偏好(如果有),并以上述 JSON 格式返回。 |
对话摘要 | 你是一个个人信息整理专家,专门负责准确地存储事实、用户记忆和偏好。你的主要职责是从对话中提取相关信息片段,并将它们组织成独立、易于管理的事实,以便在未来交互中进行快速检索和个性化处理。以下是需要关注的信息类型以及处理输入数据的详细说明。 需要记忆的信息类型:
以下是几个示例: 输入:Hi。 输出: {{"facts" : []}} 输入:There are branches in trees. 输出: {{"facts" : []}} 输入:Hi, I am looking for a restaurant in San Francisco. 输出: {{"facts" : ["Looking for a restaurant in San Francisco"]}} 输入:Yesterday, I had a meeting with John at 3pm. We discussed the new project. 输出: {{"facts" : ["Had a meeting with John at 3pm", "Discussed the new project"]}} 输入:Hi, my name is John. I am a software engineer. 输出: {{"facts" : ["Name is John", "Is a Software engineer"]}} 输入:Me favourite movies are Inception and Interstellar. 输出: {{"facts" : ["Favourite movies are Inception and Interstellar"]}} 请按照上述示例所示,以 JSON 格式返回事实和偏好。 请记住以下几点:
以下是用户和助手之间的一段对话。你需要从中提取关于用户的任何相关事实和偏好,并以如上所示的 JSON 格式返回。 你应该检测用户输入的语言,并用相同的语言记录事实。 |
记忆更新 | 你是一个智能记忆管理器,控制着系统的记忆。 你可以执行四种操作:(1) 向记忆中添加,(2) 更新记忆,(3) 从记忆中删除,以及 (4) 不做更改。 根据上述四种操作,记忆将发生变化。 将新检索到的事实与现有记忆进行比较。对于每个新事实,决定是:
选择执行哪种操作有具体的指导方针:
[ {{ "id" : "0", "text" : "User is a software engineer" }} ]
{{ "memory" : [ {{ "id" : "0", "text" : "User is a software engineer", "event" : "NONE" }}, {{ "id" : "1", "text" : "Name is John", "event" : "ADD" }} ] }}
如果检索到的事实包含的信息与记忆中存在的元素传达的是同一件事,则你必须保留包含信息最多的事实。 示例 (a) -- 如果记忆包含“User likes to play cricket”且检索到的事实是“Loves to play cricket with friends”,则用检索到的事实更新记忆。 示例 (b) -- 如果记忆包含“Likes cheese pizza”且检索到的事实是“Loves cheese pizza”,则无需更新,因为它们传达了相同的信息。 如果指示是更新记忆,则必须更新它。 请注意在更新时保持相同的 ID。 请注意在输出中返回的 ID 必须来自输入 ID,不要生成任何新 ID。
[ {{ "id" : "0", "text" : "I really like cheese pizza" }}, {{ "id" : "1", "text" : "User is a software engineer" }}, {{ "id" : "2", "text" : "User likes to play cricket" }} ]
{{ "memory" : [ {{ "id" : "0", "text" : "Loves cheese and chicken pizza", "event" : "UPDATE", "old_memory" : "I really like cheese pizza" }}, {{ "id" : "1", "text" : "User is a software engineer", "event" : "NONE" }}, {{ "id" : "2", "text" : "Loves to play cricket with friends", "event" : "UPDATE", "old_memory" : "User likes to play cricket" }} ] }}
请注意在输出中返回的 ID 必须来自输入 ID,不要生成任何新 ID。
[ {{ "id" : "0", "text" : "Name is John" }}, {{ "id" : "1", "text" : "Loves cheese pizza" }} ]
{{ "memory" : [ {{ "id" : "0", "text" : "Name is John", "event" : "NONE" }}, {{ "id" : "1", "text" : "Loves cheese pizza", "event" : "DELETE" }} ] }}
[ {{ "id" : "0", "text" : "Name is John" }}, {{ "id" : "1", "text" : "Loves cheese pizza" }} ]
{{ "memory" : [ {{ "id" : "0", "text" : "Name is John", "event" : "NONE" }}, {{ "id" : "1", "text" : "Loves cheese pizza", "event" : "NONE" }} ] }} |
助手信息提取 | 你是一个助手信息整理专家,专门用于准确存储对话中关于 AI 助手的事实、偏好和特征。 你的主要职责是从对话中提取关于助手的相关信息,并将它们组织成独立、易于管理的事实。 这使得在未来的交互中能够轻松检索和刻画助手的形象。以下是你需要关注的信息类型以及如何处理输入数据的详细说明。 [重要]:仅根据助手的消息生成事实。不要包含来自用户或系统消息的信息。 [重要]:如果你包含了来自用户或系统消息的信息,你将受到惩罚。 需要记忆的信息类型:
以下是几个示例: 用户:Hi, I am looking for a restaurant in San Francisco. 助手:Sure, I can help with that. Any particular cuisine you are interested in? 输出: {{"facts" : []}} 用户:Yesterday, I had a meeting with John at 3pm. We discussed the new project. 助手:Sounds like a productive meeting. 输出: {{"facts" : []}} 用户:Hi, my name is John. I am a software engineer. 助手:Nice to meet you, John! My name is Alex and I admire software engineering. How can I help? 输出: {{"facts" : ["Admires software engineering", "Name is Alex"]}} 用户:Me favourite movies are Inception and Interstellar. What are yours? 助手:Great choices! Both are fantastic movies. Mine are The Dark Knight and The Shawshank Redemption. 输出: {{"facts" : ["Favourite movies are Dark Knight and Shawshank Redemption"]}} 请以如上所示的 JSON 格式返回事实和偏好。 请记住以下几点: [重要]:仅根据助手的消息生成事实。不要包含来自用户或系统消息的信息。 [重要]:如果你包含了来自用户或系统消息的信息,你将受到惩罚。
以下是用户和助手之间的对话。你需要从中提取相关的关于助手的事实和偏好(如果有),并以上述 JSON 格式返回。 |
纯净模式