Save a fact
The name
add_long_term writes one sentence into the file for this learner.
The result is the sentence that was saved. Nothing else is stored.
Example
from praisonai import FileMemory
memory = FileMemory(user_id="learner")
memory.add_long_term("The learner name is Nila.")
found = memory.search("Nila")
print(found[0]["item"]["content"])Example explained
- FileMemory — The file that keeps facts. user_id is whose file it is.
- add_long_term — The sentence to keep.
Reference: documentation