mem0 icon indicating copy to clipboard operation
mem0 copied to clipboard

Some information are not stored

Open herryelbert opened this issue 9 months ago • 6 comments

Hi, I'm using mem0 for my langgraph. I noticed that sometimes mem0 does not save information even though it's not redundant, and it's very necessary. Are there any way to fix this?

This is my code for mem0

from mem0 import Memory from dotenv import load_dotenv import os

load_dotenv()

config = { "llm": { "provider": "openai", "config": { "model": "gpt-4o" } }, "vector_store": { "provider": "supabase", "config": { "connection_string": os.getenv("DATABASE_URL"), "collection_name": "memories" } } }

client = Memory.from_config(config)


And this is for saving

try: messages = json.loads(data)

    # Insert the messages into mem0
    client.add([messages], user_id=session_id)
    
    result = "Chat history created."
except Exception as e:
    result = f"Failed to create chat history: {str(e)}"

print("Result chat history: ", result)

I've also checked just in case the add function failed, but it did not. I assume that the AI deems the new information as either irrelevant or redundant. Which it isn't.

herryelbert avatar Mar 26 '25 07:03 herryelbert

Does this happen only in a specific dialog piece, or u make sure it happens every time?

lemorage avatar Mar 26 '25 08:03 lemorage

Does this happen only in a specific dialog piece, or u make sure it happens every time?

So far it happens only in a specific dialog piece. I've tried deleting all the memory just to make sure that it's not redundant. I'm guessing that somehow the AI see it as irrelevant for some reason. I've also tried changing the LLM models but to no avail.

herryelbert avatar Mar 27 '25 00:03 herryelbert

I have experienced a similar problem, there is an option provided for adding a prompt to the add() function, I thought that could help If I told it what I want but it does not work.

Humphryshikunzi avatar Mar 30 '25 06:03 Humphryshikunzi

I have the same problems. I tried to add the same messages twice, one time it updated, the other time it didn't

AugustYing avatar Apr 10 '25 07:04 AugustYing

Hey @AugustYing, can you please share the code snippet and what text you are trying to pass?

That will help us to reproduce the issue and debug further.

deshraj avatar Apr 10 '25 07:04 deshraj

Hey @AugustYing, can you please share the code snippet and what text you are trying to pass?

That will help us to reproduce the issue and debug further.

Sure.

I encounted this bug while running ai agent, so the code snippet may hard to provide. Because the messages is generated by llm. These are two messages that were uploaded using ADD.

The two messages are generated in the same task, one before and one after, and the former message is successfully updated, but the latter one is not. The structure of these two messages is obviously very similar, I don't understand why one can update the other can't.

Image

Image

AugustYing avatar Apr 10 '25 07:04 AugustYing