GetMemory

Returns a list of actions (including but not limited to the messages). Currently, it only returns actions that have reference_idn: user_message and agent_message.

GetMemory(
  fromPerson: Literal["User", "Agent", "Both"],
  offset: str,
  count: str,
  maxLen: str,
  asEnglishText: str,
  summarize: str
  filterByActorIds: str
  filterByUserPersonaIds: str
)

Where:

  • fromPerson: Indicates what persona the memory should be sourced from.
  • offset: Offsets where the start of the pulled memory begins. In other words, offset is used when wanting to skip a certain number of the latest dialogue turns.
  • count: The number of conversational turns.
  • maxLen: The maximum number of characters.
  • asEnglishText: Converts any foreign language text into English. Set "true" to activate. The default is "false."
  • summarize: Summarizes the memory. Set "true" to activate. The default is "false."
  • filterByActorIds: Filters memory based on Actor IDs.
  • filterByUserPersonaIds: Filters memory based on persona IDs.

Example 1 (Basic Memory Agent)

This example uses the GetMemory command to send historical conversations to an LLM to provide a response. It allows for general conversations with your agent. Adjust the GetMemory parameters according to your needs.

{{#system~}}
{{#block(hidden=True)}}
{{set(name='agent', value=GetAgent())}}
{{set(name='user_', value=GetUser())}}
{{set(name='memory', value=GetMemory(count=40, maxLen=20000))}}
{{/block}}

AGENT-USER MEMORY
{{memory}}
{{agent}}:
{{~/system}}

{{#assistant~}}
{{gen(name='RESULT', temperature=0.75)}}
{{~/assistant}}
User: How are you?  
Agent: I'm fine!  
User: Tell me about yourself.  
Agent: I'm an AI assistant.

Example 2 (Foreign Language to English)

This example gets the memory and translates any foreign language text into English. This was tested by sending the foreign language (Afrikaans) message, "Hello hoe gaan dit?"

{{set(name='memory', value=GetMemory(count="10",maxLen="2000",asEnglishText="True"))}}  

{{SendMessage(message=memory)}} 
User: Hello hoe gaan dit?
User: Hello hoe gaan dit?
User: Hello how are you?

Example 3 (Offset)

If you need to skip a certain number of the latest dialogue instances, use the offset parameter.

{{set(name='memory', value=GetMemory(offset="2",count="10",maxLen="2000"))}}  

{{SendMessage(message=memory)}}
User: How are you?  
Agent: I'm fine!  
User: Tell me about yourself.  
Agent: I'm an AI assistant.
User: How are you?  
Agent: I'm fine!