Class CoherenceChatMemoryStore
java.lang.Object
dev.langchain4j.store.memory.chat.coherence.CoherenceChatMemoryStore
- All Implemented Interfaces:
ChatMemoryStore
A
ChatMemoryStore
backed by an Oracle Coherence named map.
The CoherenceChatMemoryStore
supports memory identifiers of any type
that is a valid Coherence NamedMap
key. The key type must properly
implement equals()
and hashCode()
and be serializable by
the configured Coherence serializer.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder to createCoherenceChatMemoryStore
instances. -
Field Summary
Modifier and TypeFieldDescriptionTheNamedMap
used to store the chat messages.static final String
The defaultNamedMap
name. -
Constructor Summary
ModifierConstructorDescriptionprotected
CoherenceChatMemoryStore
(com.tangosol.net.NamedMap<Object, String> chatMemory) Create aCoherenceChatMemoryStore
. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Return aCoherenceChatMemoryStore.Builder
to use to build aCoherenceChatMemoryStore
.static CoherenceChatMemoryStore
create()
Create a defaultCoherenceChatMemoryStore
.static CoherenceChatMemoryStore
Create aCoherenceChatMemoryStore
that uses the specified CoherenceNamedMap
name.static CoherenceChatMemoryStore
Create aCoherenceChatMemoryStore
that uses the specified CoherenceNamedMap
name.void
deleteMessages
(Object memoryId) Deletes all messages for a specified chat memory.getMessages
(Object memoryId) Retrieves messages for a specified chat memory.void
updateMessages
(Object memoryId, List<ChatMessage> messages) Updates messages for a specified chat memory.
-
Field Details
-
DEFAULT_MAP_NAME
The defaultNamedMap
name.- See Also:
-
chatMemory
TheNamedMap
used to store the chat messages.
-
-
Constructor Details
-
CoherenceChatMemoryStore
Create aCoherenceChatMemoryStore
.This method is protected, instances of
CoherenceChatMemoryStore
are created using the builder.- Parameters:
chatMemory
- theNamedMap
to store the chat history.
-
-
Method Details
-
getMessages
Description copied from interface:ChatMemoryStore
Retrieves messages for a specified chat memory.- Specified by:
getMessages
in interfaceChatMemoryStore
- 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
Description copied from interface:ChatMemoryStore
Updates messages for a specified chat memory.- Specified by:
updateMessages
in interfaceChatMemoryStore
- Parameters:
memoryId
- The ID of the chat memory.messages
- List of messages for the specified chat memory, that represent the current state of theChatMemory
. Can be serialized to JSON usingChatMessageSerializer
.
-
deleteMessages
Description copied from interface:ChatMemoryStore
Deletes all messages for a specified chat memory.- Specified by:
deleteMessages
in interfaceChatMemoryStore
- Parameters:
memoryId
- The ID of the chat memory.
-
create
Create a defaultCoherenceChatMemoryStore
.- Returns:
- a default
CoherenceChatMemoryStore
-
create
Create aCoherenceChatMemoryStore
that uses the specified CoherenceNamedMap
name.- Parameters:
name
- the name of the CoherenceNamedMap
used to store documents- Returns:
- a
CoherenceChatMemoryStore
-
create
Create aCoherenceChatMemoryStore
that uses the specified CoherenceNamedMap
name.- Parameters:
map
- theNamedMap
used to store documents- Returns:
- a
CoherenceChatMemoryStore
-
builder
Return aCoherenceChatMemoryStore.Builder
to use to build aCoherenceChatMemoryStore
.- Returns:
- a
CoherenceChatMemoryStore.Builder
to use to build aCoherenceChatMemoryStore
-