Skip to main content

Crate mem7

Crate mem7 

Source
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() },
    ];
    let result = engine.add(&messages, None, None, None).await?;
    println!("{result:?}");

    Ok(())
}

Modules§

dedup
Memory deduplication utilities.
embedding
Embedding client trait and the built-in OpenAI-compatible implementation.
history
SQLite-backed audit history.
llm
LLM client trait and the built-in OpenAI-compatible implementation.
vector
Vector index trait and built-in implementations (in-process flat index, Upstash).

Structs§

AddResult
Aggregated result of a full add() call.
ChatMessage
A chat message in the conversation.
EmbeddingConfig
Fact
A fact extracted by the LLM from a conversation.
HistoryConfig
LlmConfig
MemoryActionResult
Result of an add() operation for a single memory.
MemoryEngine
The core memory engine. Orchestrates the full add/search/get/update/delete/history pipeline.
MemoryEngineConfig
MemoryEvent
A single entry in the memory audit trail.
MemoryFilter
Filter criteria for querying memories.
MemoryItem
A single memory item stored in the system.
SearchResult
Result of a search() call.
VectorConfig

Enums§

Mem7Error
MemoryAction
The type of memory event recorded in the audit trail.

Functions§

new_memory_id
Generate a new UUIDv7 memory ID (time-sortable, RFC 9562).

Type Aliases§

Result