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.
"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.
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.
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.
- Point both memories at a real directory, run it twice, and watch the list grow.
- Set
history_db_pathto a file you can find, then open it with thesqlite3command. - Open the Qdrant directory and look at what is actually on disk.
Slow is fine. Stopping is the only problem.