
- Added memory module for LLM API - Implemented ChatMemory and FixSizeChatMemory classes - Included methods for appending, requesting, and responding to memory
30 lines
647 B
Python
30 lines
647 B
Python
|
|
|
|
class ChatMemory:
|
|
"""
|
|
ChatMemory is the base class for all chat memory classes.
|
|
"""
|
|
def __init__(self):
|
|
pass
|
|
def append(self, request, response):
|
|
"""
|
|
Append a request and response to the memory.
|
|
"""
|
|
# it must implemented in sub class
|
|
pass
|
|
def append_request(self, request):
|
|
"""
|
|
Append a request to the memory.
|
|
"""
|
|
pass
|
|
def append_response(self, response):
|
|
"""
|
|
Append a request to the memory.
|
|
"""
|
|
pass
|
|
def contexts(self):
|
|
"""
|
|
Return the contexts of the memory.
|
|
"""
|
|
pass
|