fix(example): update ReMeShortTermMemory.get_memory() signature to match base class#1424
Open
octo-patch wants to merge 2 commits intoagentscope-ai:mainfrom
Open
Conversation
…payloads (fixes agentscope-ai#1374) When users add custom fields (e.g. 'filename') to document metadata and store them in Qdrant, retrieving the documents fails with: TypeError: DocMetadata.__init__() got an unexpected keyword argument 'filename' Use @DataClass(init=False) with a custom __init__ that accepts **kwargs and sets extra fields as attributes, preserving user-defined metadata.
…tch base class The get_memory() override was missing mark, exclude_mark, prepend_summary and **kwargs parameters required by the MemoryBase interface. This caused a TypeError when ReActAgent called memory.get_memory(exclude_mark=...) on a ReMeShortTermMemory instance. Fixes agentscope-ai#1405
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1405
Problem
ReMeShortTermMemory.get_memory()was defined without any parameters, violating theMemoryBaseinterface which requiresmark,exclude_mark,prepend_summary, and**kwargs. WhenReActAgentcallsmemory.get_memory(exclude_mark=_MemoryMark.COMPRESSED), it raises:Solution
Updated
ReMeShortTermMemory.get_memory()to match the base class signature by addingmark,exclude_mark,prepend_summary, and**kwargsparameters. SinceReMeShortTermMemorymanages memory through its own ReMe pipeline (not mark-based filtering), these parameters are accepted but the underlying implementation is unchanged.Testing
The fix makes the method signature compatible with
MemoryBasesoReActAgentcan callmemory.get_memory(exclude_mark=...)without raising aTypeError.