You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I’m currently using openmemory-py 1.3.1 and encountered some unexpected behavior in the add_hsg_memory function.
My observation: In the current implementation:
`async def add_hsg_memory(content: str, tags: Optional[str] = None, metadata: Any = None, user_id: Optional[str] = None) -> Dict[str, Any]:
simhash = compute_simhash(content)
existing = db.fetchone("SELECT * FROM memories WHERE simhash=? ORDER BY salience DESC LIMIT 1", (simhash,))
if existing and hamming_dist(simhash, existing["simhash"]) <= 3:
print('deduplicated')
now = int(time.time()*1000)
boost = min(1.0, (existing["salience"] or 0) + 0.15)
db.execute("UPDATE memories SET last_seen_at=?, salience=?, updated_at=? WHERE id=?", (now, boost, now, existing["id"]))
db.commit()
return {
"id": existing["id"],
"primary_sector": existing["primary_sector"],
"sectors": [existing["primary_sector"]],
"deduplicated": True
}`
It seems that the deduplication check (SELECT * FROM memories WHERE simhash=? ...) does not filter by user_id.
This means that if two different users have similar content, they will be treated as duplicates, and salience will be boosted globally.
This can cause cross-user interference and unexpected memory updates.
Could we make the hamming_dist threshold configurable?
Currently it’s hardcoded as <= 3, but in my use case, this causes many entries to be skipped and not updated.
A configurable threshold would allow more flexible deduplication.
When using OpenAI embeddings, could we allow passing custom extra_headers to the API call?
This would be useful for scenarios where we need to include additional authentication or metadata in the request.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I’m currently using openmemory-py 1.3.1 and encountered some unexpected behavior in the add_hsg_memory function.
My observation: In the current implementation:
`async def add_hsg_memory(content: str, tags: Optional[str] = None, metadata: Any = None, user_id: Optional[str] = None) -> Dict[str, Any]:
simhash = compute_simhash(content)
existing = db.fetchone("SELECT * FROM memories WHERE simhash=? ORDER BY salience DESC LIMIT 1", (simhash,))
It seems that the deduplication check (SELECT * FROM memories WHERE simhash=? ...) does not filter by user_id.
This means that if two different users have similar content, they will be treated as duplicates, and salience will be boosted globally.
This can cause cross-user interference and unexpected memory updates.
Could we make the hamming_dist threshold configurable?
Currently it’s hardcoded as <= 3, but in my use case, this causes many entries to be skipped and not updated.
A configurable threshold would allow more flexible deduplication.
When using OpenAI embeddings, could we allow passing custom extra_headers to the API call?
This would be useful for scenarios where we need to include additional authentication or metadata in the request.
Beta Was this translation helpful? Give feedback.
All reactions