compress

open suspend override fun compress(llmSession: AIAgentLLMWriteSession, 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 language model operates, providing functionalities to manage prompts and request responses.

memoryMessages

a list of messages representing historical memory to be optionally retained if preserveMemory is true.