| Memories.sys.mjs |
This module defines functions to generate, deduplicate, and filter memories.
The primary method in this module is `generateMemories`, which orchestrates the entire pipeline:
1. Generates initial memories from a specified user data user
2. Deduplicates the newly generated memories against all existing memories
3. Filters out memories with sensitive content (i.e. financial, medical, etc.)
4. Returns the final list of memories objects
`generateMemories` requires 3 arguments:
1. `engine`: an instance of `openAIEngine` to call the LLM API
2. `sources`: an object mapping user data source types to aggregated records (i.e., {history: [domainItems, titleItems, searchItems]})
3. `existingMemoriesList`: an array of existing memory summary strings to deduplicate against
Example Usage:
const engine = await openAIEngine.build(MODEL_FEATURES.MEMORIES, DEFAULT_ENGINE_ID, SERVICE_TYPES.MEMORIES);
const sources = {history: [domainItems, titleItems, searchItems]};
const existingMemoriesList = [...]; // Array of existing memory summary strings; this should be fetched from memory storage
const newMemories = await generateMemories(engine, sources, existingMemoriesList);
|
17006 |
| MemoriesChatSource.sys.mjs |
This module handles the user message extraction from chat store
|
3408 |
| MemoriesConstants.sys.mjs |
Memory categories
|
1565 |
| MemoriesConversationScheduler.sys.mjs |
Schedules periodic generation of conversation-based memories.
Triggers memories generation when number of user messages exceeds the configured threshold ({@link MEMORIES_SCHEDULER_MESSAGES_THRESHOLD})
E.g. Usage: MemoriesConversationScheduler.maybeInit()
|
3968 |
| MemoriesDriftDetector.sys.mjs |
@typedef {object} SessionMetric
@property {string|number} sessionId Unique identifier for the session
@property {number} jsScore Jensen–Shannon divergence for the session
@property {number} avgSurprisal Average surprisal for the session
@property {number} [timestampMs] Optional timestamp for debugging
|
13079 |
| MemoriesHistoryScheduler.sys.mjs |
Schedules periodic generation of browsing history based memories.
This decides based on the #pagesVisited and periodically evaluates history drift metrics.
Triggers memories generation when drift exceeds a configured threshold.
E.g. Usage: MemoriesHistoryScheduler.maybeInit()
|
8145 |
| MemoriesHistorySource.sys.mjs |
This module handles the visit extraction data from browsing history
|
22823 |
| MemoriesManager.sys.mjs |
MemoriesManager class
|
18005 |
| MemoriesSchemas.sys.mjs |
JSON Schema for initial memories generation
|
3345 |
| moz.build |
|
610 |