Implementing Advanced Augmentation
Implementing Advanced Augmentation
Date: December 11, 2024 Topic: Feature Implementation
Overview
We introduced "Advanced Augmentation" capabilities to allow memory to be scoped and filtered. This is critical for multi-user or multi-agent environments where different entities should not access each other's memories.
Key Changes
1. New Attribution Fields
We updated the DB schema (both SQLite and Postgres) to include three key columns:
entity_id: Identifies who the memory belongs to (e.g., specific user or agent).process_id: Identifies the workflow or application context.session_id: Identifies the temporary interaction session.
2. Context Attribution API
The Memori class now includes a method to set the scope for the current instance:
memori.attribution("user-123", "process-analytics");
3. Filtered Search
All searches (and thus context retrieval) are now filtered by these IDs if they are set. This ensures that when "user-123" asks a question, they only recall memories attributed to them.
// Internal logic
const results = await db.search(vector, 5, {
entityId: "user-123",
});