Class MessageWindowChatMemory
java.lang.Object
org.springframework.ai.chat.memory.MessageWindowChatMemory
- All Implemented Interfaces:
ChatMemory
@Deprecated(since="2.1.0",
forRemoval=true)
public final class MessageWindowChatMemory
extends Object
implements ChatMemory
Deprecated, for removal: This API element is subject to removal in a future version.
A chat memory implementation that maintains a message window of a specified size,
ensuring that the total number of messages does not exceed the specified limit. When
the number of messages exceeds the maximum size, older messages are evicted.
Messages of type SystemMessage are treated specially: if a new
SystemMessage is added, all previous SystemMessage instances are
removed from the memory. Also, if the total number of messages exceeds the limit, the
SystemMessage messages are preserved while evicting other types of messages.
- Since:
- 1.0.0
- Author:
- Thomas Vitale, Ilayaperumal Gopinathan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDeprecated, for removal: This API element is subject to removal in a future version. -
Field Summary
Fields inherited from interface org.springframework.ai.chat.memory.ChatMemory
CONVERSATION_ID -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.Save the specified messages in the chat memory for the specified conversation.builder()Deprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.Clear the chat memory for the specified conversation.Deprecated, for removal: This API element is subject to removal in a future version.Get the messages in the chat memory for the specified conversation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.chat.memory.ChatMemory
add
-
Method Details
-
add
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ChatMemorySave the specified messages in the chat memory for the specified conversation.- Specified by:
addin interfaceChatMemory
-
get
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ChatMemoryGet the messages in the chat memory for the specified conversation.- Specified by:
getin interfaceChatMemory
-
clear
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ChatMemoryClear the chat memory for the specified conversation.- Specified by:
clearin interfaceChatMemory
-
builder
Deprecated, for removal: This API element is subject to removal in a future version.
-
org.springframework.ai.session.SessionServiceinspring-ai-session; a turn-aware window isEventFilter.lastN, and compaction replaces eviction