Memory store with vector embedding support for semantic search.
This store extends SQLite-based storage with embedding vectors, enabling semantic similarity search in addition to keyword search.
Embeddings are generated on-demand using the provided EmbeddingService and stored alongside memories for efficient retrieval.
Writes: store and storeAll are each one transaction - a batch is stored whole or not at all - and so are deleteMatching and opening the store. A write takes the database's write lock when it begins, waiting up to 30 seconds (the connection's busy timeout) for a writer in another instance or process on the same file.
Thread safety: one instance holds one JDBC connection and is not safe for concurrent use; share it between threads only under your own synchronization. Separate instances, in one process or several, may write the same file concurrently: SQLite serialises their transactions.
Value parameters
- config
-
Store configuration
- dbPath
-
Path to SQLite database file
- embeddingService
-
Service for generating embeddings
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Clear all memories from the store.
Clear all memories from the store.
Attributes
- Returns
-
Empty store or error
- Definition Classes
Close the database connection.
Close the database connection.
Attributes
Count memories matching a filter.
Count memories matching a filter.
Value parameters
- filter
-
Criteria for counting memories
Attributes
- Returns
-
Count or error
- Definition Classes
Delete a memory by its ID.
Delete a memory by its ID.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
Updated store or error
- Definition Classes
Delete all memories matching a filter.
Delete all memories matching a filter.
Value parameters
- filter
-
Criteria for selecting memories to delete
Attributes
- Returns
-
Updated store or error
- Definition Classes
Embed all memories that don't have embeddings.
Embed all memories that don't have embeddings.
This is useful for adding embeddings to memories imported without them.
Value parameters
- batchSize
-
Number of memories to embed per batch
Attributes
- Returns
-
Number of memories embedded
Retrieve a memory by its ID.
Retrieve a memory by its ID.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
The memory if found, or error
- Definition Classes
Recall memories matching a filter.
Recall memories matching a filter.
This is the primary retrieval method for most use cases. Returns memories sorted by relevance (most relevant first).
Value parameters
- filter
-
Criteria for filtering memories
- limit
-
Maximum number of memories to return
Attributes
- Returns
-
Matching memories sorted by relevance (most relevant first), or error
- Definition Classes
Get the most recent memories.
Get the most recent memories.
Value parameters
- filter
-
Additional filter criteria
- limit
-
Maximum number of memories
Attributes
- Returns
-
Most recent memories
- Definition Classes
Semantic search for memories similar to a query.
Semantic search for memories similar to a query.
This method uses embeddings for semantic similarity search. Falls back to keyword search if embeddings are not available.
Value parameters
- filter
-
Additional filter criteria
- query
-
The search query
- topK
-
Number of results to return
Attributes
- Returns
-
A list of ScoredMemory objects, sorted by relevance score (highest first), or error
- Definition Classes
Store a new memory.
Store a new memory.
Value parameters
- memory
-
The memory to store
Attributes
- Returns
-
Updated store or error
- Definition Classes
Store memories in one transaction: every missing embedding is computed first, in embedBatch calls of at most VectorMemoryStore.EmbeddingBatchSize texts, then all of them are written or, if any embedding call or any write fails, none is. The commit - and the file sync behind it - is paid once for the batch, not once per row.
Store memories in one transaction: every missing embedding is computed first, in embedBatch calls of at most VectorMemoryStore.EmbeddingBatchSize texts, then all of them are written or, if any embedding call or any write fails, none is. The commit - and the file sync behind it - is paid once for the batch, not once per row.
Attributes
- Definition Classes
Update a memory.
Update a memory.
Value parameters
- id
-
The memory identifier
- update
-
Function to transform the memory
Attributes
- Returns
-
Updated store or error
- Definition Classes
Get statistics about the store including embedding coverage.
Get statistics about the store including embedding coverage.
Attributes
Inherited methods
Check if a memory exists.
Check if a memory exists.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
True if memory exists
- Inherited from:
- MemoryStore
Get conversation history.
Get conversation history.
Value parameters
- conversationId
-
The conversation identifier
- limit
-
Maximum messages to return
Attributes
- Returns
-
Conversation memories in chronological order
- Inherited from:
- MemoryStore
Get all memories for a specific entity.
Get all memories for a specific entity.
Value parameters
- entityId
-
The entity identifier
Attributes
- Returns
-
All memories related to this entity
- Inherited from:
- MemoryStore
Get high-importance memories.
Get high-importance memories.
Value parameters
- limit
-
Maximum number of memories
- threshold
-
Minimum importance score (0.0 to 1.0)
Attributes
- Returns
-
Important memories
- Inherited from:
- MemoryStore