Skip to content

Commit d131bce

Browse files
authored
fix: align MOSProduct._build_system_prompt signature with MOSCore (MemTensor#146)
## Description Summary: Fix MOSProduct._build_system_prompt method signature mismatch that caused TypeError when calling MOSProduct.chat(). The child class method signature didn't match what the parent MOSCore class expected, breaking inheritance contract. Fix: #(no existing issue - this was discovered during development) Docs Issue/PR: (not applicable - internal bug fix) Reviewer: @(leave blank if you don't know who reviews PRs in this repo) ## Checklist: - [x] 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) | 我已在 [MemOS-Docs](https://github.com/MemTensor/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 的人
2 parents b572f0f + e7f32c3 commit d131bce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/memos/mem_os/product.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ def _get_or_create_user_config(
327327

328328
return self._create_user_config(user_id, user_config)
329329

330-
def _build_system_prompt(self, user_id: str, memories_all: list[TextualMemoryItem]) -> str:
330+
def _build_system_prompt(
331+
self, memories_all: list[TextualMemoryItem], base_prompt: str | None = None
332+
) -> str:
331333
"""
332334
Build custom system prompt for the user with memory references.
333335
@@ -759,7 +761,7 @@ def chat_with_references(
759761
memories_list = memories_result[0]["memories"]
760762

761763
# Build custom system prompt with relevant memories
762-
system_prompt = self._build_system_prompt(user_id, memories_list)
764+
system_prompt = self._build_system_prompt(memories_list, base_prompt=None)
763765

764766
# Get chat history
765767
target_user_id = user_id if user_id is not None else self.user_id

0 commit comments

Comments
 (0)