Package dev.langchain4j.memory.chat
Class TokenWindowChatMemory.Builder
java.lang.Object
dev.langchain4j.memory.chat.TokenWindowChatMemory.Builder
- Enclosing class:
TokenWindowChatMemory
-
Constructor Summary
-
Method Summary
-
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
- 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.tokenizer
- ATokenizer
responsible 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, anInMemoryChatMemoryStore
will be used.- Returns:
- builder
-
build
-