Class InMemoryChatMemory

java.lang.Object
org.springframework.ai.chat.memory.InMemoryChatMemory
All Implemented Interfaces:
ChatMemory

@Deprecated public class InMemoryChatMemory extends Object implements ChatMemory
Deprecated.
in favor of MessageWindowChatMemory, which internally uses InMemoryChatMemoryRepository.
The InMemoryChatMemory class is an implementation of the ChatMemory interface that represents an in-memory storage for chat conversation history. This class stores the conversation history in a ConcurrentHashMap, where the keys are the conversation IDs and the values are lists of messages representing the conversation history.
Since:
1.0.0 M1
Author:
Christian Tzolov
See Also:
  • Constructor Details

    • InMemoryChatMemory

      public InMemoryChatMemory()
      Deprecated.
  • Method Details

    • add

      public void add(String conversationId, List<Message> messages)
      Deprecated.
      Description copied from interface: ChatMemory
      Save the specified messages in the chat memory for the specified conversation.
      Specified by:
      add in interface ChatMemory
    • get

      public List<Message> get(String conversationId, int lastN)
      Deprecated.
      Specified by:
      get in interface ChatMemory
    • clear

      public void clear(String conversationId)
      Deprecated.
      Description copied from interface: ChatMemory
      Clear the chat memory for the specified conversation.
      Specified by:
      clear in interface ChatMemory