fix(agent-framework): give each add_memory call its own document - #1751
Open
harshitgavita-07 wants to merge 2 commits into
Open
harshitgavita-07 wants to merge 2 commits into
harshitgavita-07 wants to merge 2 commits into
Conversation
Clarified memory handling by removing custom_id in memory addition.
…ument id Add tests to ensure unique document IDs for memory entries.
This branch has not been deployed
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.
Problem
SupermemoryTools.add_memoryinagent-framework-pythonpassescustom_id=self._connection.custom_id(conversation_<id>) on every call.In Supermemory a stable
customIdidentifies one document, and re-adding under it updates that document (see thecustomIdnotes in the ingest docs). So with this tool:add_memorycall in a conversation replaces the first remembered fact instead of adding a new one, andconnection.custom_id, so they overwrite each other.supermemory_openai'sadd_memorydoes not pass acustom_id, so each fact is its own document there. This makes the agent-framework tool match.Fix
Drop
custom_idfrom theadd_memorytool call.connection.custom_idis unchanged and still used for conversation capture.Test
New
TestAddMemoryDocumentIdentityrecords the arguments of twoadd_memorycalls and asserts neither reusesconnection.custom_id. It fails onmainand passes with this change. Full package suite: 59 passed (58 existing plus the new one).I did not run this against the live API. The overwrite behavior comes from the documented
customIdsemantics, not from a live reproduction.