mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Move ChatMemory protocol to components.memory; rename files to use "_" convention for implementations. (#101)
This commit is contained in:
3
python/src/agnext/components/memory/__init__.py
Normal file
3
python/src/agnext/components/memory/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from ._base import ChatMemory
|
||||
|
||||
__all__ = ["ChatMemory"]
|
||||
19
python/src/agnext/components/memory/_base.py
Normal file
19
python/src/agnext/components/memory/_base.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import List, Mapping, Protocol, TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class ChatMemory(Protocol[T]):
|
||||
"""A protocol for defining the interface of a chat memory. A chat memory
|
||||
lets agents store and retrieve messages. It can be implemented with
|
||||
different memory recall strategies."""
|
||||
|
||||
async def add_message(self, message: T) -> None: ...
|
||||
|
||||
async def get_messages(self) -> List[T]: ...
|
||||
|
||||
async def clear(self) -> None: ...
|
||||
|
||||
def save_state(self) -> Mapping[str, T]: ...
|
||||
|
||||
def load_state(self, state: Mapping[str, T]) -> None: ...
|
||||
Reference in New Issue
Block a user