2024-06-12 08:25:42 -07:00
|
|
|
# Memory
|
|
|
|
|
|
|
|
Memory is a collection of data corresponding to the conversation history
|
|
|
|
of an agent.
|
2024-06-13 00:10:35 -07:00
|
|
|
Data in meory can be just a simple list of all messages,
|
|
|
|
or one which provides a view of the last N messages
|
2024-06-12 15:21:20 -04:00
|
|
|
({py:class}`agnext.chat.memory.BufferedChatMemory`).
|
2024-06-13 00:10:35 -07:00
|
|
|
|
|
|
|
Built-in memory implementations are:
|
|
|
|
|
|
|
|
- {py:class}`agnext.chat.memory.BufferedChatMemory`
|
|
|
|
- {py:class}`agnext.chat.memory.HeadAndTailChatMemory`
|
|
|
|
|
|
|
|
To create a custom memory implementation, you need to subclass the
|
2024-06-21 05:05:54 -07:00
|
|
|
{py:class}`agnext.components.memory.ChatMemory` protocol class and implement
|
2024-06-13 00:10:35 -07:00
|
|
|
all its methods.
|
|
|
|
For example, you can use [LLMLingua](https://github.com/microsoft/LLMLingua)
|
|
|
|
to create a custom memory implementation that provides a compressed
|
|
|
|
view of the conversation history.
|