mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

The value of created_at differs between search and get_all results

Open enchyisle opened this issue 1 month ago • 3 comments

With the following script, I can reproduce the scenario where the value of "created_at" of a memory is sometimes (2/3) changed to the value of "updated_at" when returned by the SEARCH API. Is that by design?

from time import sleep
from mem0 import MemoryClient
import os
from dotenv import load_dotenv
import json
load_dotenv()

client = MemoryClient(api_key=os.getenv("MEM0_API_KEY"))
messages = [
  { "role": "user", "content": "Hi, I'm Alex. I'm a vegetarian and I'm allergic to nuts." },
  { "role": "assistant", "content": "Hello Alex! I see that you're a vegetarian with a nut allergy." }
]

res = client.add(messages, user_id="alex002",timestamp=1683364760)
print(res)

sleep(30) 
query = "What am I allergic to?"

filters = {
 "OR":[
    {
       "user_id":"alex002"
    }
 ]
}

result = client.search(query, filters=filters)
print("search result:")
print(json.dumps(result, indent=4))

results = client.get_all(filters=filters)
print("get all result:")
print(json.dumps(results, indent=4))

search result: { "results": [ { "id": "abbed504-3b9b-4908-a051-d72078821dc6", "memory": "Allergic to nuts", "user_id": "alex002", "metadata": null, "categories": [ "health" ], "created_at": "2023-05-06T02:19:20-07:00", "updated_at": "2025-11-06T01:22:06-08:00", "expiration_date": null, "score": 0.7412318, "structured_attributes": { "day": 6, "hour": 9, "year": 2023, "month": 5, "minute": 19, "quarter": 2, "is_weekend": true, "day_of_week": "saturday", "day_of_year": 126, "week_of_year": 18 } }, { "id": "9f9b9bf0-fa14-4fc8-8da8-16cfbc864cec", "memory": "Vegetarian", "user_id": "alex002", "metadata": null, "categories": null, "created_at": "2025-11-06T01:22:05-08:00", "updated_at": "2025-11-06T01:22:05-08:00", "expiration_date": null, "score": 0.47491649999999996, "structured_attributes": { "year": 2023, "month": 5, "day": 6, "hour": 9, "minute": 19, "day_of_week": "saturday", "week_of_year": 18, "day_of_year": 126, "quarter": 2, "is_weekend": true } }, { "id": "02635868-3c4c-4024-be3b-766d00ef0ddf", "memory": "Name is Alex", "user_id": "alex002", "metadata": null, "categories": null, "created_at": "2025-11-06T01:22:05-08:00", "updated_at": "2025-11-06T01:22:05-08:00", "expiration_date": null, "score": 0.4260473, "structured_attributes": { "year": 2023, "month": 5, "day": 6, "hour": 9, "minute": 19, "day_of_week": "saturday", "week_of_year": 18, "day_of_year": 126, "quarter": 2, "is_weekend": true } } ] } get all result: { "results": [ { "id": "9f9b9bf0-fa14-4fc8-8da8-16cfbc864cec", "memory": "Vegetarian", "user_id": "alex002", "metadata": null, "categories": [ "food", "user_preferences" ], "created_at": "2023-05-06T02:19:20-07:00", "updated_at": "2025-11-06T01:22:05.427579-08:00", "expiration_date": null, "structured_attributes": { "day": 6, "hour": 9, "year": 2023, "month": 5, "minute": 19, "quarter": 2, "is_weekend": true, "day_of_week": "saturday", "day_of_year": 126, "week_of_year": 18 } }, { "id": "abbed504-3b9b-4908-a051-d72078821dc6", "memory": "Allergic to nuts", "user_id": "alex002", "metadata": null, "categories": [ "health" ], "created_at": "2023-05-06T02:19:20-07:00", "updated_at": "2025-11-06T01:22:06.403907-08:00", "expiration_date": null, "structured_attributes": { "day": 6, "hour": 9, "year": 2023, "month": 5, "minute": 19, "quarter": 2, "is_weekend": true, "day_of_week": "saturday", "day_of_year": 126, "week_of_year": 18 } }, { "id": "02635868-3c4c-4024-be3b-766d00ef0ddf", "memory": "Name is Alex", "user_id": "alex002", "metadata": null, "categories": [ "personal_details" ], "created_at": "2023-05-06T02:19:20-07:00", "updated_at": "2025-11-06T01:22:05.163976-08:00", "expiration_date": null, "structured_attributes": { "day": 6, "hour": 9, "year": 2023, "month": 5, "minute": 19, "quarter": 2, "is_weekend": true, "day_of_week": "saturday", "day_of_year": 126, "week_of_year": 18 } } ] }

enchyisle avatar Nov 06 '25 09:11 enchyisle

Hey @enchyisle thanks for reporting this , I will reproduce this and get back to you !

parthshr370 avatar Nov 06 '25 14:11 parthshr370

@parthshr370 can you assign this to me

tanmay958 avatar Nov 07 '25 21:11 tanmay958

Hey @tanmay958 Sure! just please mention the approach you will take here , its ideal we all come to the same page first and then you spend time solving this !

plus this seems to be a platform related issue which I think you wont be able to modify

as here client = MemoryClient()

parthshr370 avatar Nov 08 '25 15:11 parthshr370