compress
open suspend override fun compress(llmSession: AIAgentLLMWriteSession, preserveMemory: Boolean, memoryMessages: List<Message>)(source)
Compresses the conversation history by retaining the last N messages, generating a summary, and composing the resulting prompt with the necessary messages.
Parameters
llmSession
the session in which the local language model operates, providing functionalities to manage prompts and request responses.
preserveMemory
a flag indicating whether memory messages should be preserved and included in the final composed prompt.
memoryMessages
a list of messages representing historical memory to be optionally retained if preserveMemory is true.