Advanced Augmentation

Advanced Augmentation is the AI engine inside Memori that turns raw conversations into structured, searchable memories. It runs asynchronously in the background to minimize impact on your response path. All extracted data is stored directly in your database.

What It Does

When your application has a conversation through a Memori-wrapped LLM client, the augmentation engine:

  1. Reads the full conversation (user messages and AI responses)
  2. Identifies facts, preferences, skills, attributes, and events
  3. Extracts semantic triples (subject-predicate-object relationships)
  4. Generates vector embeddings for semantic search
  5. Stores everything in your database

No extra code required — just initialize Memori with your database connection and set attribution.

How It Works

The augmentation flow is fully asynchronous and designed to avoid blocking your main request path.

  1. Your app makes an LLM call through the wrapped client
  2. Memori returns the response immediately
  3. In the background, the conversation is queued for processing
  4. The augmentation engine extracts structured memories
  5. Memories are stored in your database for future recall

In short-lived scripts, call mem.augmentation.wait() to ensure processing completes before exit.

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from memori import Memori
from openai import OpenAI

engine = create_engine("sqlite:///memori.db")
SessionLocal = sessionmaker(bind=engine)

client = OpenAI()
mem = Memori(conn=SessionLocal).llm.register(client)
mem.attribution(entity_id="user_123", process_id="my_agent")
mem.config.storage.build()

# This returns immediately — no augmentation delay
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": "I love hiking in the mountains."}
    ]
)
print(response.choices[0].message.content)

# Only needed in short-lived scripts
mem.augmentation.wait()

Extraction Types

TypeWhat it capturesScope
FactsObjective information with vector embeddingsPer entity — shared across processes
PreferencesUser choices, opinions, and tastesPer entity
Skills & KnowledgeAbilities and expertise levelsPer entity
AttributesProcess-level information about what your agent handlesPer process

Database tables:

TablePurpose
memori_conversationStores conversations
memori_conversation_messageIndividual messages within conversations
memori_sessionGroups related LLM interactions
memori_entityEntities (users, organizations, etc.)
memori_processProcesses (agents, bots, workflows)
memori_entity_factExtracted facts with vector embeddings
memori_process_attributeProcess-level attributes and characteristics

Semantic Triples

Advanced Augmentation uses named-entity recognition to extract semantic triples (subject, predicate, object). These form the building blocks of the Knowledge Graph.

Example — from "My favorite database is PostgreSQL and I use it with FastAPI":

SubjectPredicateObject
userfavorite_databasePostgreSQL
userusesFastAPI
useruses_withPostgreSQL + FastAPI

Memori automatically deduplicates triples — if the same fact is mentioned multiple times, it increments the mention count and updates the timestamp.

Database tables: memori_subject, memori_predicate, memori_object, memori_knowledge_graph

Embeddings

Vector embeddings are created using the all-mpnet-base-v2 sentence transformer with 768 dimensions. These embeddings power the semantic search used for context recall via cosine similarity.

Context Recall

When a query is sent to an LLM through a wrapped client, Memori automatically:

  1. Intercepts the outbound LLM call
  2. Uses semantic search to find entity facts matching the query
  3. Passes vector embeddings to FAISS for similarity ranking
  4. Injects the top-N most relevant facts into the system prompt
  5. Forwards the enriched request to the LLM provider

Schema ERD

Memori Schema ERD

When to Use It

  • Chatbots or AI assistants with returning users
  • Use cases that need to remember user preferences across sessions
  • You want personalized AI interactions
  • With multi-step workflows or agentic systems
  • For building relationships between entities