zykrix
Re-added phidata as a normal folder (final fix)
c96b98a
Raw
History Blame Contribute Delete
1.07 kB
from abc import ABC, abstractmethod
from typing import Optional, List
from phi.memory.row import MemoryRow
class MemoryDb(ABC):
"""Base class for the Memory Database."""
@abstractmethod
def create(self) -> None:
raise NotImplementedError
@abstractmethod
def memory_exists(self, memory: MemoryRow) -> bool:
raise NotImplementedError
@abstractmethod
def read_memories(
self, user_id: Optional[str] = None, limit: Optional[int] = None, sort: Optional[str] = None
) -> List[MemoryRow]:
raise NotImplementedError
@abstractmethod
def upsert_memory(self, memory: MemoryRow) -> Optional[MemoryRow]:
raise NotImplementedError
@abstractmethod
def delete_memory(self, id: str) -> None:
raise NotImplementedError
@abstractmethod
def drop_table(self) -> None:
raise NotImplementedError
@abstractmethod
def table_exists(self) -> bool:
raise NotImplementedError
@abstractmethod
def clear(self) -> bool:
raise NotImplementedError