Skip to content

fix: Extracting too many missing_documents embeddings cause embedder error #1482

@RyuGuo

Description

@RyuGuo

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 | 问题描述

I find an embedder call error when memos extracts too many missing_documents embeddings.

warning log

SearchHandler - WARNING - search_handler.py:258 - _mmr_dedup_text_memories - [SearchHandler] MMR embedding metadata missing; will compute missing embeddings: missing_total=25

env
EMBEDDING URL: https://dashscope.aliyuncs.com/compatible-mode/v1
EMBEDDING MODEL: text-embedding-v4

In src/memos/api/handlers/search_handler.py:448

if missing_indices:
  computed = self.searcher.embedder.embed(missing_documents) # ⚠️here, embedding 25 missing_documents will return None
  for idx, embedding in zip(missing_indices, computed, strict=False):
      embeddings[idx] = embedding
      memories[idx]["metadata"]["embedding"] = embedding

Can someone fix it?

How to Reproduce | 如何重现

  1. insert a lot of messages
  2. search a query

Environment | 环境信息

  • MemOS version: 2.0.12

Additional Context | 其他信息

  • MemOS v2.0.13 still has same problem.

No response

Willingness to Implement | 实现意愿

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

Metadata

Metadata

Assignees

No one assigned

    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