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

infer=False: storing what was actually said

Everything so far has gone through the model. Sometimes you do not want a judgement, you want the sentence, and there is a flag for that.

Example
from pretend_mem0 import memory

shop = memory()
result = shop.add("Ravi prefers email updates. Thanks!", user_id="ravi",
                  infer=False)
for stored in result["results"]:
    print(stored["memory"])

The whole string, including the thanks, stored exactly as given. No model was called, nothing was split, nothing was dropped.

When that is what you want

When you already know the fact. A user ticks email me in a settings page. There is nothing to extract, and asking a model to think about it is slower, costlier and occasionally wrong.

When the text is already a summary. If another part of your system has written customer prefers email, delivery to office, putting that through an extractor only risks it coming out worse.

When you are testing. Storing exactly what you meant to store makes it obvious whether a search problem is in the search or in the extraction.

What you give up

Example
from pretend_mem0 import memory

shop = memory()
shop.add("Ravi prefers email updates. Thanks!", user_id="ravi", infer=False)
for hit in shop.search("email", filters={"user_id": "ravi"})["results"]:
    print(round(hit["score"], 2), "|", hit["memory"])

The memory is one lump containing the useful part and the noise, so the score is lower than it would be for a clean fact, and everything you search for drags the thanks along with it. Over a few hundred conversations that difference decides whether search works.

infer=False is still embedded and still searchable. It skips the model, not the embedder. The only thing it turns off is the judgement about what is worth keeping.
Try it yourself
  • Store the same sentence with and without infer=False and compare what each search returns.
  • Store a settings-style fact like notification channel: email and see how it scores.
  • Store an entire paragraph with infer=False and search for a word buried in the middle of it.

Little by little, you're building something great.