A note is not a preference

Two places

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.

Example

from praisonai import KeywordIndex, 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.

Reference: documentation