Vector Store Support
Generic vector-store support for semantic memory dedupe.
This module resolves full-store scan support directly from the configured vector-store section so scheduled semantic dedupe does not depend on any memory-provider client implementation or Mem0 SDK factory wiring.
ElasticsearchSemanticDedupeScanner(*, vector_store)
Scan memory rows directly from one Elasticsearch-backed vector store.
Initialize one Elasticsearch scanner from resolved vector-store config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_store
|
dict[str, Any]
|
Resolved vector-store payload with provider and config. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the payload does not contain a usable Elasticsearch config. |
close()
async
Release scan state and close the underlying Elasticsearch client.
count_partition_sizes(*, lookback_since=None)
async
Return partition sizes using one Elasticsearch composite aggregation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lookback_since
|
datetime | None
|
Optional recent-window
lower bound for |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, int]
|
dict[str, int]: Partition-size map keyed by stored role-source-target. |
scan_page(*, page, page_size, lookback_since=None)
async
Return one page of memory rows from Elasticsearch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
page
|
int
|
One-based page number. |
required |
page_size
|
int
|
Number of rows to request. |
required |
lookback_since
|
datetime | None
|
Optional recent-window
lower bound for |
None
|
Returns:
| Type | Description |
|---|---|
list[Chunk]
|
list[Chunk]: Memory rows mapped into chunks. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If pagination inputs are invalid. |
build_semantic_dedupe_scheduler_key_from_manager_config(config)
Build one stable scheduler key from the configured vector store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | MemoryManagerConfig | None
|
Memory manager config input. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: Stable scheduler key, or |
build_semantic_dedupe_store_scanner_from_manager_config(config)
Build one vector-store scanner directly from memory-manager config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | MemoryManagerConfig | None
|
Memory manager config input. |
required |
Returns:
| Type | Description |
|---|---|
BaseSemanticMemoryStoreScanner | None
|
BaseSemanticMemoryStoreScanner | None: Scanner instance, or |