Where the fact is kept
Note: Chroma, mem0, and MongoDB are on this page so you can see the setting. They have no Try it button.
A file and SQLite
The same name is saved twice. The file is a note on disk. SQLite is a relational database: one row in the table long_term_memory.
Press Try it Yourself, then Run. File prints the name from the file. Table prints long_term_memory. Row prints the same name from that table.
Example
import sqlite3
from praisonaiagents.memory import FileMemory
from praisonaiagents.memory.adapters import SqliteMemoryAdapter
files = FileMemory(user_id="learner")
files.add_long_term("The learner name is Nila.")
database = SqliteMemoryAdapter(short_db="/tmp/uni-short.db", long_db="/tmp/uni-long.db")
database.store_long_term("The learner name is Nila.")
connection = sqlite3.connect("/tmp/uni-long.db")
print("File")
print(files.search("name")[0]["item"]["content"])
print("Table")
print(connection.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='long_term_memory'").fetchone()[0])
print("Row")
print(connection.execute("SELECT content FROM long_term_memory").fetchone()[0])Example explained
- FileMemory — Writes the fact to a JSON file. No database.
- long_term_memory — The relational table. A row holds the sentence in the content column.
- SqliteMemoryAdapter — Opens that SQLite file. SQLite is built in.
Chroma
Chroma is a vector database. A later question can match the meaning, as well as the words. Install chromadb on your computer, then set memory to chromadb. There is no Try it button.
Example
from praisonai import Agent
agent = Agent(
instructions="You remember the learner.",
memory="chromadb",
)mem0
mem0 keeps facts for many people, and it can use a cloud database. It needs the mem0 package. There is no Try it button.
Example
from praisonai import Agent
agent = Agent(
instructions="You remember the learner.",
memory="mem0",
)MongoDB
MongoDB keeps the fact in a database you already run. Install pymongo and point memory at mongodb. This site does not start a database, so there is no Try it button.
Example
from praisonai import Agent
agent = Agent(
instructions="You remember the learner.",
memory="mongodb",
)Reference: documentation