A note is not a preference

Two places

Beginners often mix up RAG notes and Memory. Use Knowledge/RAG notes for shared documents and reference facts (manuals, policies, schedules), and use Memory for personal user preferences and conversation history.

A note answers a question about a document. Memory answers a question about the person.

Note prints the boat line. Memory prints the name. They are not the same store.

Expected output: the boat fact is retrieved from the note, while the user's name is recalled from memory — two distinct stores doing two distinct jobs.

Example

from praisonai.knowledge import KeywordIndex
from praisonai.memory import FileMemory

lines = [
    "Apples grow on trees in the orchard.",
    "The secret colour of the boat is blue.",
]
index = KeywordIndex()
index.add_documents(lines)
memory = FileMemory(user_id="learner")
memory.add_long_term("The learner name is Nila.")
print("Note")
print(index.query("What colour is the boat?", top_k=1)[0]["text"])
print("Memory")
print(memory.search("name")[0]["item"]["content"])

Try it Yourself

Example explained

  • KeywordIndex — Search over the note. This is RAG.
  • FileMemory — The person’s fact. This is memory.

Decision rule: shared truth vs personal preference

Ask one question before storing text: 'Does this apply to all users or only this specific person?' Shared company docs, prices, and policies go into RAG (Knowledge); individual preferences, roles, and history go into per-user Memory.

Common pitfall: storing rapidly changing product pricing inside each customer's personal memory creates stale contradictions across accounts.

Reference: documentation