Skip to main content

Memory

Memory in an AI assistant refers to its capability to retain and utilize the context of a chat. It affects how the assistant understands and responds to a sequence of messages, maintaining coherence and relevance. The right choice of memory type is crucial for optimizing the assistant's performance based on the nature of the intended interaction.

We offer several memory types to suit different use cases.

AssistantZeroMemory

Zero memory is ideal for applications where context isn't required. It treats each interaction as an independent instance.

import taskingai
from taskingai.assistant.memory import AssistantZeroMemory

assistant = taskingai.assistant.create_assistant(
model_id="YOUR_MODEL_ID",
memory=AssistantZeroMemory()
)

It is best for single-instance translation, one-off Q&A sessions, or scenarios where each query is unrelated to the previous ones.

AssistantNaiveMemory

Naive memory uses a straightforward approach to memory management, storing all messages in a chat session.

from taskingai.assistant.memory import AssistantNaiveMemory

assistant = taskingai.assistant.create_assistant(
model_id="YOUR_MODEL_ID",
memory=AssistantNaiveMemory()
)

It is a naive implementation of memory that retains all messages, maximizing memory recall and enhancing the precision of responses. Perfect for customer service interactions or situations where conversations are brief and to the point, focusing on quick query resolution.

AssistantMessageWindowMemory

AssistantMessageWindowMemory is optimized for long conversational threads where maintaining recent context is crucial. It avoids token wastage by focusing on the most relevant parts of the conversation.

from taskingai.assistant.memory import AssistantMessageWindowMemory

assistant = taskingai.assistant.create_assistant(
model_id="YOUR_MODEL_ID",
memory=AssistantMessageWindowMemory(
max_messages=20,
max_tokens=1000
)
)

The memory is suitable for in-depth dialogues or scenarios where a detailed history of the conversation is necessary, such as technical support or in-depth advisory services.

info

TaskingAI is committed to enhancing our assistant system with the introduction of more advanced and diverse memory types in the future.