Class TokenWindowChatMemory.Builder
java.lang.Object
dev.langchain4j.memory.chat.TokenWindowChatMemory.Builder
- Enclosing class:
TokenWindowChatMemory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()chatMemoryStore(ChatMemoryStore store) maxTokens(Integer maxTokens, TokenCountEstimator tokenCountEstimator)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
id
- Parameters:
id- The ID of theChatMemory. If not provided, a "default" will be used.- Returns:
- builder
-
maxTokens
public TokenWindowChatMemory.Builder maxTokens(Integer maxTokens, TokenCountEstimator tokenCountEstimator) - Parameters:
maxTokens- The maximum number of tokens to retain. Chat memory will retain as many of the most recent messages as can fit intomaxTokens. Messages are indivisible. If an old message doesn't fit, it is evicted completely.tokenCountEstimator- ATokenCountEstimatorresponsible for counting tokens in the messages.- Returns:
- builder
-
chatMemoryStore
- Parameters:
store- The chat memory store responsible for storing the chat memory state. If not provided, anSingleSlotChatMemoryStorewill be used.- Returns:
- builder
-
build
-