1"""Base memory interface for bot memory implementations."""

2

3 from abc import ABC, abstractmethod

4 from typing import Any

5

6

7 class Memory(ABC):

8 """Abstract base class for memory implementations."""

9

10 @abstractmethod

11 async def add_message(

12 self, content: str, role: str, metadata: dict[str, Any] | None = None

13 ) -> None:

14 """Add message to memory.

15

16 Args:

17 content: Message content

18 role: Message role (user, assistant, system, etc.)

19 metadata: Optional metadata for the message

20 """

21 pass

22

23 @abstractmethod

24 async def get_context(self, current_message: str) -> list[dict[str, Any]]:

25 """Get relevant context for current message.

26

27 Args:

28 current_message: The current message to get context for

29

30 Returns:

31 List of relevant message dictionaries

32 """

33 pass

34

35 @abstractmethod

36 async def clear(self) -> None:

37 """Clear all memory."""

38 pass