Skip to content

fix: general_text_memory fails due to unexpected type returned by LLM #138

@CaralHsi

Description

@CaralHsi

Pre-submission checklist | 提交前检查

  • I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Bug Description | 问题描述

Description:

When using general_text_memory to extract structured memories, the prompt does not strictly constrain the type field returned by the LLM. As a result, the model may return values such as "goal" or "plan" instead of the expected literal values, causing pydantic validation to fail with a Literal mismatch. This leads to the entire memory item being discarded.

How to Reproduce | 如何重现

How to Reproduce:
1. Use a general prompt (e.g., SIMPLE_STRUCT_MEM_READER_PROMPT) to extract memory.
2. Do not explicitly restrict the output type in the prompt.
3. LLM may return non-allowed types like "goal" or "plan".
4. Pydantic throws a validation error like:

Environment | 环境信息

memos v0.2.1

Additional Context | 其他信息

No response

Willingness to Implement | 实现意愿

  • I'm willing to implement this myself | 我愿意自己解决
  • I would like someone else to implement this | 我希望其他人来解决

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpendingPending items to be addressed | 待解决事项。

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions