FromTimestamp
A strategy for compressing message histories using a specified timestamp as a reference point. This strategy removes messages that occurred before a given timestamp and creates a summarized context for further interactions.
This strategy preserves all system messages as well as the first user message (if presented) and memory messages (if provided) and then appends tldr of the subset of messages starting from the provided timestamp (except trailing tool calls).
Parameters
timestamp
The timestamp indicating the earliest point to retain messages from.
Functions
Link copied to clipboard
open suspend override fun compress(llmSession: AIAgentLLMWriteSession, memoryMessages: List<Message>)
Compresses the conversation history by retaining the messages from the timestamp, generating a summary, and composing the resulting prompt with the necessary messages.