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
  • Field Details

  • Constructor Details

    • ChatMemoryConfiguration

      public ChatMemoryConfiguration()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface io.micronaut.core.util.Toggleable
    • setEnabled

      public void setEnabled(boolean enabled)
      Parameters:
      enabled - Whether the default chat memory provider is enabled. Defaults to true.
    • getStore

      public @Nullable String getStore()
      Returns:
      The name of the chat memory store bean
    • setStore

      public void setStore(@Nullable String store)
      Parameters:
      store - The name of the ChatMemoryStore bean 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

      public ChatMemoryConfiguration.Type getType()
      Returns:
      How the memory evicts old messages
    • setType

      public void setType(ChatMemoryConfiguration.Type type)
      Parameters:
      type - How the memory evicts old messages. Defaults to MESSAGE_WINDOW.
    • getMaxMessages

      public @Nullable Integer getMaxMessages()
      Returns:
      The maximum number of messages of a message window memory
    • setMaxMessages

      public void setMaxMessages(@Nullable Integer maxMessages)
      Parameters:
      maxMessages - The maximum number of messages of a message window memory. Defaults to langchain4j.chat-memory-store.message-window.max-messages (20).
    • getMaxTokens

      public @Nullable Integer getMaxTokens()
      Returns:
      The maximum number of tokens of a token window memory
    • setMaxTokens

      public void setMaxTokens(@Nullable Integer maxTokens)
      Parameters:
      maxTokens - The maximum number of tokens of a token window memory. Required with TOKEN_WINDOW.