Class InMemoryChatMemoryStore
-
- All Implemented Interfaces:
-
dev.langchain4j.store.memory.chat.ChatMemoryStore
public class InMemoryChatMemoryStore implements ChatMemoryStore
Implementation of ChatMemoryStore that stores state of dev.langchain4j.memory.ChatMemory (chat messages) in-memory.
This storage mechanism is transient and does not persist data across application restarts.
-
-
Constructor Summary
Constructors Constructor Description InMemoryChatMemoryStore()Constructs a new InMemoryChatMemoryStore.
-
Method Summary
Modifier and Type Method Description List<ChatMessage>getMessages(Object memoryId)Retrieves messages for a specified chat memory. voidupdateMessages(Object memoryId, List<ChatMessage> messages)Updates messages for a specified chat memory. voiddeleteMessages(Object memoryId)Deletes all messages for a specified chat memory. -
-
Constructor Detail
-
InMemoryChatMemoryStore
InMemoryChatMemoryStore()
Constructs a new InMemoryChatMemoryStore.
-
-
Method Detail
-
getMessages
List<ChatMessage> getMessages(Object memoryId)
Retrieves messages for a specified chat memory.
- Parameters:
memoryId- The ID of the chat memory.- Returns:
List of messages for the specified chat memory. Must not be null. Can be deserialized from JSON using ChatMessageDeserializer.
-
updateMessages
void updateMessages(Object memoryId, List<ChatMessage> messages)
Updates messages for a specified chat memory.
- Parameters:
memoryId- The ID of the chat memory.messages- List of messages for the specified chat memory, that represent the current state of the ChatMemory.
-
deleteMessages
void deleteMessages(Object memoryId)
Deletes all messages for a specified chat memory.
- Parameters:
memoryId- The ID of the chat memory.
-
-
-
-