Skip to content

fix: update mem_reader_prompts#1162

Open
Mozy403 wants to merge 14 commits intoMemTensor:dev-20260302-v2.0.8from
Mozy403:dev-test1
Open

fix: update mem_reader_prompts#1162
Mozy403 wants to merge 14 commits intoMemTensor:dev-20260302-v2.0.8from
Mozy403:dev-test1

Conversation

@Mozy403
Copy link

@Mozy403 Mozy403 commented Mar 5, 2026

Description

Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.

Related Issue (Required): Fixes @#1168

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

Reviewer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed
  • Tests have been provided

Copilot AI review requested due to automatic review settings March 5, 2026 02:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the document “simple struct” reader prompts to better incorporate optional reference context and to clarify the expected JSON schema for extracted memories.

Changes:

  • Added explicit guidance on how to use provided context (without fabricating facts) in both EN and ZH prompts.
  • Updated the JSON schema description to allow memory_type to be either LongTermMemory or UserMemory.
  • Added richer EN/ZH examples demonstrating context-aware extraction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 227 to 229
SIMPLE_STRUCT_DOC_READER_PROMPT = """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.

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description still contains template placeholders (e.g., “Fixes @issue_number”) and no concrete testing steps. Please update the description with the linked issue number and how this prompt change was validated (example inputs / regression checks), since prompt updates can materially change extraction behavior.

Copilot uses AI. Check for mistakes.
Comment on lines 362 to 365
如果给定了上下文,就结合上下文信息作为文档信息提取的补充,如果没有给定上下文,请直接处理文档信息。
参考的上下文:
{context}

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the ZH prompt, the real {context} block is placed before the example (lines 362-365). This makes the example appear after the real input context, which can bias the model to mix example details into the output. Consider moving the example section above any real {context}/{chunk_text} placeholders (matching the EN prompt structure) so the example is clearly separated from the actual input.

Copilot uses AI. Check for mistakes.
Comment on lines +400 to +403
如果给定了上下文,就结合上下文信息作为文档信息提取的补充,如果没有给定上下文,请直接处理文档信息。
参考的上下文:
{context}

Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIMPLE_STRUCT_DOC_READER_PROMPT_ZH repeats the “如果给定了上下文...” instruction and includes {context} twice (lines 400-403 duplicates 362-364). This adds unnecessary tokens and can confuse the model about which context to use. Recommend keeping a single context instruction + {context} placeholder (ideally right before 文档片段: {chunk_text}) and removing the duplicate block.

Suggested change
如果给定了上下文就结合上下文信息作为文档信息提取的补充如果没有给定上下文请直接处理文档信息
参考的上下文
{context}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants