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
Nested ClassesModifier and TypeClassDescriptionstatic classA builder to createCoherenceChatMemoryStoreinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionTheNamedMapused to store the chat messages.static final StringThe defaultNamedMapname. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCoherenceChatMemoryStore(com.tangosol.net.NamedMap<Object, String> chatMemory) Create aCoherenceChatMemoryStore. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Return aCoherenceChatMemoryStore.Builderto use to build aCoherenceChatMemoryStore.static CoherenceChatMemoryStorecreate()Create a defaultCoherenceChatMemoryStore.static CoherenceChatMemoryStoreCreate aCoherenceChatMemoryStorethat uses the specified CoherenceNamedMapname.static CoherenceChatMemoryStoreCreate aCoherenceChatMemoryStorethat uses the specified CoherenceNamedMapname.voiddeleteMessages(Object memoryId) Deletes all messages for a specified chat memory.getMessages(Object memoryId) Retrieves messages for a specified chat memory.voidupdateMessages(Object memoryId, List<ChatMessage> messages) Updates messages for a specified chat memory.
-
Field Details
-
DEFAULT_MAP_NAME
-
chatMemory
-
-
Constructor Details
-
CoherenceChatMemoryStore
Create aCoherenceChatMemoryStore.This method is protected, instances of
CoherenceChatMemoryStoreare created using the builder.- Parameters:
chatMemory- theNamedMapto store the chat history.
-
-
Method Details
-
getMessages
Description copied from interface:ChatMemoryStoreRetrieves messages for a specified chat memory.- Specified by:
getMessagesin 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:ChatMemoryStoreUpdates messages for a specified chat memory.- Specified by:
updateMessagesin 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:ChatMemoryStoreDeletes all messages for a specified chat memory.- Specified by:
deleteMessagesin interfaceChatMemoryStore- Parameters:
memoryId- The ID of the chat memory.
-
create
Create a defaultCoherenceChatMemoryStore.- Returns:
- a default
CoherenceChatMemoryStore
-
create
Create aCoherenceChatMemoryStorethat uses the specified CoherenceNamedMapname.- Parameters:
name- the name of the CoherenceNamedMapused to store chat messages- Returns:
- a
CoherenceChatMemoryStore
-
create
Create aCoherenceChatMemoryStorethat uses the specified CoherenceNamedMapname.- Parameters:
map- theNamedMapused to store chat messages- Returns:
- a
CoherenceChatMemoryStore
-
builder
Return aCoherenceChatMemoryStore.Builderto use to build aCoherenceChatMemoryStore.- Returns:
- a
CoherenceChatMemoryStore.Builderto use to build aCoherenceChatMemoryStore
-