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
When configuring azure_ai_search as the vector_store in the mem0 project, updating a user's memory via m.add(xxx, user_id="") does not respect the user_id filter. Specifically, an update intended for one user inadvertently modifies another user's memory.
Sample code:
frompprintimportpprintfrommem0importMemorym=Memory.from_config(config_dict={
"version": "v1.1",
"vector_store": {
"provider": "azure_ai_search",
"config": {
"service_name": "",
"api_key": "",
"collection_name": "",
"embedding_model_dims": 3072,
"use_compression": False
}
}
})
# Add memory for Alicem_alice=m.add("my name is Alice", user_id="Alice")
print("m_alice: ", m_alice)
# Add memory for Bobm_bob=m.add("my name is Bob", user_id="Bob")
print("m_bob: ", m_bob)
# Wait for the operations to completetime.sleep(10)
# Retrieve all memoriesprint("Final:")
pprint(m.get_all())
When adding memory for Bob, instead of creating a new memory entry, it updates Alice's existing memory.
The event for Bob's operation is 'UPDATE' with 'previous_memory': 'Name is Alice'.
In the final output, there's only one memory entry with user_id: 'Alice', but the memory content is 'Name is Bob'.
Expected Behavior:
Each user should have their own separate memory entries. Adding a memory for Bob should create a new entry associated with user_id: 'Bob', without affecting Alice's memory.
Actual Behavior:
Bob's memory addition updates Alice's existing memory instead of creating a new one. This indicates that the user_id filter is not functioning properly in the azure_ai_search vector store implementation, leading to cross-user data contamination.
Additional Information
The text was updated successfully, but these errors were encountered:
After looking into the implementation of mem0/vector_stores/azure_ai_search.py, I noticed that the index is created with only three fields: id, vector, and payload. The current approach fetches all documents and then filters them afterward.
Applying a limit before filtering could exclude relevant documents that should be included after filtering.
Ineffective Filtering:
The filtering logic doesn't seem to work as intended, so documents aren't correctly filtered by user_id.
These issues might be causing the problem where one user's memory updates another's memory. I'll submit a pull request soon to modify the implementation and address these concerns.
🐛 Describe the bug
When configuring
azure_ai_search
as thevector_store
in the mem0 project, updating a user's memory viam.add(xxx, user_id="")
does not respect the user_id filter. Specifically, an update intended for one user inadvertently modifies another user's memory.Sample code:
Output
Issue Details:
As shown in the output:
event
for Bob's operation is'UPDATE'
with'previous_memory': 'Name is Alice'
.user_id: 'Alice'
, but the memory content is'Name is Bob'
.Expected Behavior:
Each user should have their own separate memory entries. Adding a memory for Bob should create a new entry associated with
user_id: 'Bob'
, without affecting Alice's memory.Actual Behavior:
Bob's memory addition updates Alice's existing memory instead of creating a new one. This indicates that the user_id filter is not functioning properly in the azure_ai_search vector store implementation, leading to cross-user data contamination.
Additional Information
The text was updated successfully, but these errors were encountered: