Long/Short-Term Memory

In the architecture of the HelperAI conversational agent, memories can be classified based on their source into two types: observations and intentions.

  • Observations: these include the dialogue text input by the end user and the agent's responses after calling tool commands.
  • Intentions: these include the agent's spoken words to the end user and the tool command parameters inferred and generated by the agent through observations.

During the runtime of the agent, all generated memories are stored in persistent storage, enabling the agent to continue execution from the previous memories for the next decision-making round. However, due to the context window limitation in most AI language models for generating prompts (usually measured in paragraph-length tokens), not all past memories can be included in the prompt. Instead, necessary filtering is required to select the most relevant memories to include in the prompt.

In the HelperAI architecture, you can set separate sizes for short-term memory and long-term memory. The short-term memory consists of the most recent N sets of memories, which will always be selected for the next decision-making round. The long-term memory consists of memories further back in history than the N short-term memories, from which the most relevant X memories related to the current conversation topic are selected. You can adjust these two values as needed to meet your requirements.

Please note that selecting appropriate sizes for long and short-term memory is crucial. Insufficient memory can lead to unnecessary illusions or excessive duplicate command intentions during language model decision-making due to a lack of sufficient context data. On the other hand, excessive memory sizes may cause language models to make decisions less efficiently due to an abundance of context data or even unintentionally exceed the context window limitation of the language model, resulting in unexpected errors.

For more information on defining the sizes of long and short-term memory, please refer to the "memory-size.md" guide.