MCPcopy Create free account
hub / github.com/Forethought-Technologies/AutoChain / BaseMemory

Class BaseMemory

autochain/memory/base.py:17–42  ·  view source on GitHub ↗

Base interface for memory in chains.

Source from the content-addressed store, hash-verified

15
16
17class BaseMemory(BaseModel, ABC):
18 """Base interface for memory in chains."""
19
20 @abstractmethod
21 def load_memory(
22 self, key: Union[str, None] = None, default: Optional[Any] = None, **kwargs: Any
23 ) -> Any:
24 """Return key-value pairs given the text input to the chain."""
25
26 @abstractmethod
27 def load_conversation(self, **kwargs) -> ChatMessageHistory:
28 """Return key-value pairs given the text input to the chain."""
29
30 @abstractmethod
31 def save_memory(self, key: str, value: Any) -> None:
32 """Save the context of this model run to memory."""
33
34 @abstractmethod
35 def save_conversation(
36 self, message: str, message_type: MessageType, **kwargs
37 ) -> None:
38 """Save the context of this model run to memory."""
39
40 @abstractmethod
41 def clear(self) -> None:
42 """Clear memory contents."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected