FromLastNMessages
A strategy for compressing history by retaining only the last n
messages in a session.
This class removes all but the last n
messages from the current prompt history and then compresses the retained messages into a summary (TL;DR). It also allows integration of specific memory messages back into the prompt if needed.
Properties
Functions
Link copied to clipboard
open suspend override fun compress(llmSession: AIAgentLLMWriteSession, preserveMemory: Boolean, memoryMessages: List<Message>)
Compresses the conversation history by retaining the last N messages, generating a summary, and composing the resulting prompt with the necessary messages.