Semantic Memory
Semantic memory dedupe job for offline cleanup runs.
This module owns the weekend dedupe orchestration only. Shared settings, models, and helper logic live in focused sibling modules.
SemanticMemoryDedupeJob(*, memory_client, scanner, strategy=None, retain_decisions=False)
Offline semantic dedupe runner for whole-store weekend cleanup.
Initialize the dedupe job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
memory_client
|
BaseMemoryClient
|
Provider-neutral client used for semantic search, list, update, and delete operations. |
required |
scanner
|
BaseSemanticMemoryStoreScanner
|
Vector-store scanner used for whole-store reads during the offline dedupe pass. |
required |
strategy
|
BaseSemanticMemoryDedupeStrategy | None
|
Duplicate strategy override. Defaults to the embedding-only strategy. |
None
|
retain_decisions
|
bool
|
Whether to keep per-group decision details in memory. Defaults to False. |
False
|
run(*, similarity_threshold=DEFAULT_MEMORY_DEDUP_SIMILARITY_THRESHOLD, max_candidates_per_anchor=DEFAULT_MEMORY_DEDUP_MAX_CANDIDATES_PER_ANCHOR, max_target_memories=DEFAULT_MEMORY_DEDUP_MAX_TARGET_MEMORIES, lookback_days=DEFAULT_MEMORY_DEDUP_LOOKBACK_DAYS)
async
Run dedupe for the whole configured vector-store target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
similarity_threshold
|
float
|
Threshold for duplicate
detection. Defaults to |
DEFAULT_MEMORY_DEDUP_SIMILARITY_THRESHOLD
|
max_candidates_per_anchor
|
int
|
Maximum semantic search
candidates requested for one anchor. Defaults to |
DEFAULT_MEMORY_DEDUP_MAX_CANDIDATES_PER_ANCHOR
|
max_target_memories
|
int
|
Optional safeguard for one
partition size. |
DEFAULT_MEMORY_DEDUP_MAX_TARGET_MEMORIES
|
lookback_days
|
int
|
Number of recent days included by the
whole-store scan, using |
DEFAULT_MEMORY_DEDUP_LOOKBACK_DAYS
|
Returns:
| Name | Type | Description |
|---|---|---|
SemanticMemoryDedupeRunResult |
SemanticMemoryDedupeRunResult
|
Aggregate run result. |