Skip to content

Conversation

@Osier-Yi
Copy link
Member

AgentScope Version

[The version of AgentScope you are working on, e.g. import agentscope; print(agentscope.__version__)]

Description

in Mem0LongTermMemoy, record_to_memory: if user_id is provided, the content will be stored as user's memory
if self.user_id is not None:
message_role = "user"
else:
message_role = "assistant"
# here set infer to False to force the memory to be recorded as is
results = await self._mem0_record(
[
{
"role": message_role,
"content": "\n".join(content),
"name": message_role,
},
],
**kwargs,
)

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with pre-commit run --all-files command
  • All tests are passing
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@Osier-Yi Osier-Yi requested review from DavdGao and zhijianma October 21, 2025 09:59
Copy link
Member

@DavdGao DavdGao left a comment

Choose a reason for hiding this comment

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

Please see inline comments

@DavdGao DavdGao assigned Copilot and unassigned Copilot Oct 21, 2025
@DavdGao DavdGao requested a review from Copilot October 21, 2025 12:26
Copy link

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

This pull request fixes the message role assignment in Mem0LongTermMemory's record_to_memory method. Previously, all recorded messages were hardcoded as "assistant" role. Now, when a user_id is provided during initialization, messages are correctly recorded with "user" role, otherwise they use "assistant" role.

Key Changes:

  • Fixed role assignment logic in record_to_memory to dynamically set role based on user_id presence
  • Updated example to use text-embedding-v3 with explicit dimensions configuration
  • Simplified and restructured README documentation for better clarity

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/agentscope/memory/_mem0_long_term_memory.py Added conditional logic to set message role based on user_id presence
examples/functionality/long_term_memory/mem0/memory_example.py Updated embedding model version, added vector store configuration, and improved system prompt
examples/functionality/long_term_memory/mem0/README.md Restructured documentation to be more concise and user-friendly

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@DavdGao DavdGao left a comment

Choose a reason for hiding this comment

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

LGTM

@DavdGao DavdGao merged commit c0f2aff into agentscope-ai:main Oct 22, 2025
10 checks passed
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.

3 participants