GitHub
Memory System

Personalization Engine

Models user preferences and identity to tailor interactions.

Storage: Neo4j (:User-[:PREFERS]->:Preference)

Purpose

The Personalization Engine ensures the agent adapts to the specific user over time. It infers preferences from interactions and explicitly reconciles conflicting information to build a coherent user model.

Key Features

  • Inference: Automatically infers preferences from chat hints (e.g., "I hate Python" → lang: python, sentiment: negative).
  • Reconciliation: Resolves conflicting preferences via LLM strategies (e.g., changing taste over time).

Functional Deep Dive

Inference

The engine analyzes chat history to find patterns. If a user repeatedly asks for Python code, it infers prefers_language: python without the user explicitly stating it.

Reconciliation

Uses an LLM to merge conflicting preferences. If an old preference says "Likes Java" and a recent one says "Hates Java", the engine updates the graph to "Hates Java" with high confidence, treating it as a preference update.

Inference Diagram

API Reference

Personalization Engine provides endpoints for managing user preferences.

MethodEndpointDescription
POST/api/memory/v1/personalization/preferencesAdd user preference
GET/api/memory/v1/personalization/preferences/user_idGet user preferences
PUT/api/memory/v1/personalization/preferences/preference_idUpdate preference
DELETE/api/memory/v1/personalization/preferences/preference_idDelete preference
POST/api/memory/v1/personalization/contextGet personalized context
POST/api/memory/v1/personalization/inferInfer preferences
POST/api/memory/v1/personalization/reconcileReconcile preferences

SDK Reference

The Functor SDK provides a Python interface for personalization operations.

Managing Preferences

from functor_sdk import FunctorClient
client = FunctorClient(api_key="your-api-key")
# Add preference
client.memory.personalization.add_preference(
user_id="user_123",
preference_key="language",
preference_value="python",
source="explicit",
confidence=1.0
)
# Get preferences
prefs = client.memory.personalization.get_preferences(user_id="user_123")
# Get personalized context
context = client.memory.personalization.get_context(
user_id="user_123",
query="show me examples",
limit=10
)
# Infer preferences from history
inferred = client.memory.personalization.infer_preferences(
user_id="user_123",
interaction_history=[...]
)
# Reconcile conflicting preferences
reconciled = client.memory.personalization.reconcile(
user_id="user_123",
new_entities=[...],
strategy="llm_guided"
)