Expand description
§mem7
LLM-powered long-term memory engine with a Rust core and Python bindings.
§Quick start
use mem7::{MemoryEngine, MemoryEngineConfig, ChatMessage, MemoryFilter};
#[tokio::main]
async fn main() -> mem7::Result<()> {
let config = MemoryEngineConfig::default();
let engine = MemoryEngine::new(config).await?;
let messages = vec![
ChatMessage { role: "user".into(), content: "I love Rust".into(), images: vec![] },
];
let result = engine.add(&messages, None, None, None, None, true).await?;
println!("{result:?}");
Ok(())
}Modules§
- dedup
- Memory deduplication utilities.
- embedding
- Embedding client trait and the built-in implementations.
- graph
- Graph store trait and built-in implementations (FlatGraph, Kuzu, Neo4j).
- history
- Audit history trait and built-in SQLite implementation.
- llm
- LLM client trait and the built-in OpenAI-compatible implementation.
- reranker
- Reranker trait and built-in implementations (Cohere, LLM-based).
- vector
- Vector index trait and built-in implementations (in-process flat index, Upstash).
Structs§
- AddOptions
- Options for the
MemoryEngine::add()method. - AddResult
- Aggregated result of a full add() call.
- Chat
Message - A chat message in the conversation.
- Embedding
Config - Fact
- A fact extracted by the LLM from a conversation.
- Graph
Config - Graph
Relation - A graph relation (subject-predicate-object triple).
- History
Config - LlmConfig
- Memory
Action Result - Result of an add() operation for a single memory.
- Memory
Engine - The core memory engine. Orchestrates the full add/search/get/update/delete/history pipeline.
- Memory
Engine Builder - Builder for
MemoryEnginewith dependency injection support. - Memory
Engine Config - Memory
Event - A single entry in the memory audit trail.
- Memory
Filter - Filter criteria for querying memories.
- Memory
Item - A single memory item stored in the system.
- Reranker
Config - Search
Options - Options for the
MemoryEngine::search()method. - Search
Result - Result of a search() call.
- Telemetry
Config - Vector
Config
Enums§
- Mem7
Error - Memory
Action - The type of memory event recorded in the audit trail.
Functions§
- new_
memory_ id - Generate a new UUIDv7 memory ID (time-sortable, RFC 9562).