Memory
Memory module for the GLLM agents.
References
https://github.com/GDP-ADMIN/gdplabs-exploration/blob/ai-agent-app/backend/gllm_agents/memory/init.py
BaseMemory
Bases: ABC
Base class for agent memory.
This concrete base class provides a default structure. Subclasses can inherit from this class to implement specific memory management behaviors.
add_message(message)
abstractmethod
Add a message to the memory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
ChatMessage
|
The ChatMessage object to add. |
required |
add_messages(messages)
Add multiple messages to the memory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
messages |
Sequence[ChatMessage]
|
A sequence of ChatMessage objects to add. |
required |
clear()
abstractmethod
Clears the memory or resets the state of the agent.
This method must be implemented to define the specific behavior for clearing or resetting the memory of the agent.
get_memory_variables()
Retrieve memory variables.
This method returns a dictionary containing memory-related variables. The default implementation returns a dictionary with chat_history.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary where keys are variable names and values |
Dict[str, Any]
|
are the corresponding memory-related data. |
get_messages()
abstractmethod
Retrieve a list of messages.
Returns:
Type | Description |
---|---|
List[ChatMessage]
|
List[ChatMessage]: A list of messages in a generic format. |
ChatMessage
Bases: BaseModel
Represents a single message in a chat conversation.