BaseVectorDB
Interface Class
This interface defines the contract that all vector database implementations must follow.
memora.vector_db.base.BaseVectorDB
Bases: ABC
Abstract base class defining a common interface for different Vector DB implementations.
This class provides a standardized interface for vector database operations including adding, searching, and deleting memories.
Functions
add_memories
abstractmethod
async
add_memories(
org_id: str,
user_id: str,
agent_id: str,
memory_ids: List[uuid.UUID],
memories: List[str],
obtained_at: str,
) -> None
Add memories to collection with their org_id, user_id, agent_id, and obtained_at datetime as metadata.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Organization ID for the memories
TYPE:
|
user_id
|
User ID for the memories
TYPE:
|
agent_id
|
Agent ID for the memories
TYPE:
|
memory_ids
|
List of UUIDs for each memory
TYPE:
|
memories
|
List of memory strings to add
TYPE:
|
obtained_at
|
ISO format datetime string when the memories were obtained
TYPE:
|
Source code in memora/vector_db/base.py
close
abstractmethod
async
delete_all_organization_memories
abstractmethod
async
Delete all memories associated with an organization.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
ID of the organization whose memories should be deleted
TYPE:
|
Source code in memora/vector_db/base.py
delete_all_user_memories
abstractmethod
async
Delete all memories associated with a specific user.
PARAMETER | DESCRIPTION |
---|---|
org_id
|
Organization ID the user belongs to
TYPE:
|
user_id
|
ID of the user whose memories should be deleted
TYPE:
|
Source code in memora/vector_db/base.py
delete_memories
abstractmethod
async
Delete multiple memories by their IDs.
PARAMETER | DESCRIPTION |
---|---|
memory_ids
|
List of memory IDs to delete
TYPE:
|
delete_memory
abstractmethod
async
Delete a memory by its ID with optional org/user filtering.
PARAMETER | DESCRIPTION |
---|---|
memory_id
|
ID of the memory to delete
TYPE:
|
search_memories
abstractmethod
async
search_memories(
queries: List[str],
memory_search_scope: MemorySearchScope,
org_id: str,
user_id: Optional[str] = None,
agent_id: Optional[str] = None,
) -> List[List[Tuple[models.Memory, float]]]
Batch memory search with optional user/agent filtering.
PARAMETER | DESCRIPTION |
---|---|
queries
|
List of search query strings
TYPE:
|
memory_search_scope
|
Memory search scope (organization or user)
TYPE:
|
org_id
|
Organization ID for filtering
TYPE:
|
user_id
|
Optional user ID for filtering
TYPE:
|
agent_id
|
Optional agent ID for filtering
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[List[Tuple[Memory, float]]]
|
List[List[Tuple[models.Memory, float]]] of search results for each query, with a tuple containing: Memory:
float: Score of the memory |
Source code in memora/vector_db/base.py
search_memory
abstractmethod
async
search_memory(
query: str,
memory_search_scope: MemorySearchScope,
org_id: str,
user_id: Optional[str] = None,
agent_id: Optional[str] = None,
) -> List[Tuple[models.Memory, float]]
Memory search with optional user/agent filtering.
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query string
TYPE:
|
memory_search_scope
|
Memory search scope (organization or user)
TYPE:
|
org_id
|
Organization ID for filtering
TYPE:
|
user_id
|
Optional user ID for filtering
TYPE:
|
agent_id
|
Optional agent ID for filtering
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
List[Tuple[Memory, float]]
|
List[Tuple[Memory, float]] containing tuple of search results and score: Memory:
float: Score of the memory |