Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some information are not stored #2443

Open
herryelbert opened this issue Mar 26, 2025 · 6 comments
Open

Some information are not stored #2443

herryelbert opened this issue Mar 26, 2025 · 6 comments

Comments

@herryelbert
Copy link

herryelbert commented Mar 26, 2025

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.

@lemorage
Copy link

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

@herryelbert
Copy link
Author

herryelbert commented Mar 27, 2025

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.

@Humphryshikunzi
Copy link

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.

@AugustYing
Copy link

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

@deshraj
Copy link
Collaborator

deshraj commented Apr 10, 2025

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.

@AugustYing
Copy link

AugustYing commented Apr 10, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants