Rust core with Python, TypeScript & Rust bindings.
Extracts facts from conversations, deduplicates, and stores them in vector databases with full audit history.
pip install mem7
npm install @mem7ai/mem7
cargo add mem7
Get up and running in minutes. Pick your language to get started.
from mem7 import Memory
from mem7.config import MemoryConfig, LlmConfig, EmbeddingConfig
config = MemoryConfig(
llm=LlmConfig(
base_url="http://localhost:11434/v1",
api_key="ollama",
model="qwen2.5:7b",
),
embedding=EmbeddingConfig(
base_url="http://localhost:11434/v1",
api_key="ollama",
model="mxbai-embed-large",
dims=1024,
),
)
m = Memory(config=config)
# Add a memory from conversation
m.add("I love playing tennis and my coach is Sarah.", user_id="alice")
# Semantic search
results = m.search("What sports does Alice play?", user_id="alice")
# Get all memories for a user
memories = m.get_all(user_id="alice")
import { MemoryEngine } from "@mem7ai/mem7";
const engine = await MemoryEngine.create(JSON.stringify({
llm: {
base_url: "http://localhost:11434/v1",
api_key: "ollama",
model: "qwen2.5:7b",
},
embedding: {
base_url: "http://localhost:11434/v1",
api_key: "ollama",
model: "mxbai-embed-large",
dims: 1024,
},
}));
// Add a memory from conversation
await engine.add(
[{ role: "user", content: "I love playing tennis and my coach is Sarah." }],
"alice"
);
// Semantic search
const results = await engine.search("What sports does Alice play?", "alice");
// Get all memories for a user
const memories = await engine.getAll("alice");
use mem7::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let config = MemoryConfig {
llm: LlmConfig {
base_url: "http://localhost:11434/v1".into(),
api_key: "ollama".into(),
model: "qwen2.5:7b".into(),
..Default::default()
},
embedding: EmbeddingConfig {
base_url: "http://localhost:11434/v1".into(),
api_key: "ollama".into(),
model: "mxbai-embed-large".into(),
dims: 1024,
..Default::default()
},
..Default::default()
};
let engine = MemoryEngine::new(config).await?;
// Add a memory
engine.add(messages, "alice", None, None).await?;
// Semantic search
let results = engine.search("What sports?", "alice", None, None, 5).await?;
Ok(())
}
High-performance Rust core with zero-cost language bindings.
Async Rust core with tokio runtime. Native speed for embedding, deduplication, and vector operations.
First-class Python, TypeScript, and Rust APIs. Zero-overhead bindings via PyO3 and napi-rs.
Swap LLMs, embeddings, and vector stores via config. One OpenAI-compatible client covers most providers.
Every ADD, UPDATE, and DELETE is recorded in a SQLite audit log with full history per memory.
Memories are isolated per user_id. Each user has their own memory space with no cross-contamination.
LLM-driven deduplication decides whether to add, update, or skip based on existing memories.
One OpenAI-compatible client covers most LLM and embedding providers out of the box.
Any OpenAI-compatible API works
Any OpenAI-compatible API works
Use mem7 from your preferred language.