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.
NOTE: The
GetMemoryaction will only return memory of the project agent in which this action is executed. For example main conversation of user and AI Agent will be innaf.ConvoAgentand if you useGetMemoryinyour_project.ExampleAgent.CustomFlow.MySkillthen it will only return memory available to yourExampleAgent. To get around that you can subscribe your skill to the eventbroadcast_analyze_conversation.
GetMemory(
fromPerson: Literal["User", "Agent", "Both"] = "Both",
offset: int = 0,
count: int = 10,
maxLen: int = 200,
asEnglishText: bool = False,
summarize: bool = False,
fromDate: datetime | None = None,
toDate: datetime | None = None,
filterByActorIds: list[UUID] | None = None,
filterByUserPersonaIds: list[UUID] | None = None,
sessionId: UUID | None = None
)
Where:
| Parameter | Type | Default | Description |
|---|---|---|---|
fromPerson | Literal["User", "Agent", "Both"] | "Both" | Indicates what persona the memory should be sourced from. |
offset | int | 0 | 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 | int | 10 | The number of conversational turns. |
maxLen | int | 200 | The maximum number of characters. |
asEnglishText | bool | False | Converts any foreign language text into English. Set "true" to activate. |
summarize | bool | False | Summarizes the memory. Set "true" to activate. |
fromDate | datetime | None | None | Filters start of turns and accepts ISO-8601 format. |
toDate | datetime | None | None | Filters end of turns and accepts ISO-8601 format. |
filterByActorIds | list[UUID] | None | None | Filters the memory based on Actor IDs and shows only that memory. |
filterByUserPersonaIds | list[UUID] | None | None | Filters the memory based on Persona IDs and shows only that memory. |
sessionId | UUID | None | None | The session identifier to filter memory by. |
If filterByActorIds is set, the context user_persona_id and filterByUserPersonaIds parameters are ignored. If the filterByUserPersonaIds parameter is set, the context user_persona_id parameter is ignored.
Example 1 (Filter by Actor IDs)
This example uses the GetMemory command to get conversations of an Agent and User. Adjust the GetMemory parameters
according to your needs.
{% set user_id = GetUser().id | string %}
{% set newo_voice_actors = GetActors(
personaId=user_id,
integrationIdn="newo_voice"
) %}
{% set newo_chat_actors = GetActors(
personaId=user_id,
integrationIdn="newo_chat"
) %}
{% set actors = newo_voice_actors + newo_chat_actors %}
{{Return(val=GetMemory(filterByActorIds=actors))}}User: How are you?
ConvoAgent: I'm fine!
User: Tell me about yourself.
ConvoAgent: 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?"
{{Return(val=GetMemory(asEnglishText="True"))}}User: Hello how are you?Example 3 (Offset)
If you need to skip a certain number of the most recent dialogue turns from the top, use the offset parameter. For example, offset=2 skips the 2 latest turns and begins returning memory starting from the 3rd most recent turn.
{{Return(val=GetMemory(offset=2, count=10))}}User: How are you?
ConvoAgent: I'm fine! Updated 13 days ago
