Mem0mem0ai 2.0.20 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
24 small wins to finish your pathNext lesson

Where memories live: the vector store

Every memory in this course has vanished at the end of the lesson, because the helper hands Qdrant a fresh temporary directory each time. That is right for a course and wrong for an application.

The store is the third piece from lesson 3, and the only one that never needed replacing, because Qdrant runs inside the process. Point it at a directory you keep and the memories outlive the program.

python
"vector_store": {"provider": "qdrant", "config": {
    "path": "memories",
    "embedding_model_dims": 64,
}},

Proving it persists

The helper takes overrides, so one directory shared by two separate memories is enough to show it.

Example
import tempfile
from pretend_mem0 import memory

shared = tempfile.mkdtemp()
store = {"provider": "qdrant", "config": {
    "path": shared, "embedding_model_dims": 64, "on_disk": False}}

first = memory(vector_store=store)
first.add("Deliver to my office.", user_id="ravi")
del first

second = memory(vector_store=store)
print([m["memory"] for m in second.get_all(filters={"user_id": "ravi"})["results"]])

The second memory never stored anything and can read what the first one wrote. That is all persistence is here: a path that stays the same.

One process at a time. Embedded Qdrant holds the directory open, so a second program pointing at the same path while the first is running will fail to take it. That is the moment to run Qdrant as a server instead, which is a host and port in the same config block rather than a path.

The other half of the store

Memories go in Qdrant. The history from lesson 16 does not: it lives in a SQLite file, set by history_db_path in the same configuration. Back up one and not the other and you will still lose the record of what changed.

Other stores

Mem0 supports around thirty vector stores: Chroma, pgvector, Redis, Pinecone, Weaviate, Milvus and the rest. They are all the same two lines, a provider name and its own config block, and nothing in this course changes when you swap one in. Qdrant is the default because it is the one that needs nothing installed.

Try it yourself
  • Point both memories at a real directory, run it twice, and watch the list grow.
  • Set history_db_path to a file you can find, then open it with the sqlite3 command.
  • Open the Qdrant directory and look at what is actually on disk.

Slow is fine. Stopping is the only problem.