Class ChatMemoryConfiguration
java.lang.Object
io.micronaut.langchain4j.store.memory.chat.ChatMemoryConfiguration
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
@ConfigurationProperties("langchain4j.chat-memory")
public final class ChatMemoryConfiguration
extends Object
implements io.micronaut.core.util.Toggleable
Configures the default
ChatMemoryProvider of the AI services: the chat memory
store the conversations are kept in, and how the memory evicts old messages.- Since:
- 2.4.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow the memory evicts old messages. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Integer@Nullable Integer@Nullable StringgetStore()getType()booleanvoidsetEnabled(boolean enabled) voidsetMaxMessages(@Nullable Integer maxMessages) voidsetMaxTokens(@Nullable Integer maxTokens) voidvoid
-
Field Details
-
PREFIX
-
-
Constructor Details
-
ChatMemoryConfiguration
public ChatMemoryConfiguration()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable
-
setEnabled
public void setEnabled(boolean enabled) - Parameters:
enabled- Whether the default chat memory provider is enabled. Defaults totrue.
-
getStore
- Returns:
- The name of the chat memory store bean
-
setStore
- Parameters:
store- The name of theChatMemoryStorebean the conversations are kept in. Defaults to the persistent chat memory store if there is exactly one (Redis, Neo4j, Cassandra, JDBC...), otherwise the in-memory store.
-
getType
- Returns:
- How the memory evicts old messages
-
setType
- Parameters:
type- How the memory evicts old messages. Defaults toMESSAGE_WINDOW.
-
getMaxMessages
- Returns:
- The maximum number of messages of a message window memory
-
setMaxMessages
- Parameters:
maxMessages- The maximum number of messages of a message window memory. Defaults tolangchain4j.chat-memory-store.message-window.max-messages(20).
-
getMaxTokens
- Returns:
- The maximum number of tokens of a token window memory
-
setMaxTokens
- Parameters:
maxTokens- The maximum number of tokens of a token window memory. Required withTOKEN_WINDOW.
-