fix: update mem_reader_prompts#1162
fix: update mem_reader_prompts#1162Mozy403 wants to merge 14 commits intoMemTensor:dev-20260302-v2.0.8from
Conversation
There was a problem hiding this comment.
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_typeto be eitherLongTermMemoryorUserMemory. - Added richer EN/ZH examples demonstrating context-aware extraction.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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. | ||
|
|
There was a problem hiding this comment.
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.
| 如果给定了上下文,就结合上下文信息作为文档信息提取的补充,如果没有给定上下文,请直接处理文档信息。 | ||
| 参考的上下文: | ||
| {context} | ||
|
|
There was a problem hiding this comment.
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.
| 如果给定了上下文,就结合上下文信息作为文档信息提取的补充,如果没有给定上下文,请直接处理文档信息。 | ||
| 参考的上下文: | ||
| {context} | ||
|
|
There was a problem hiding this comment.
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.
| 如果给定了上下文,就结合上下文信息作为文档信息提取的补充,如果没有给定上下文,请直接处理文档信息。 | |
| 参考的上下文: | |
| {context} |
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.
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
Checklist
Reviewer Checklist