WholeHistory

WholeHistory is a concrete implementation of the HistoryCompressionStrategy that encapsulates the logic for compressing entire conversation history into a succinct summary (TL;DR) and composing the necessary messages to create a streamlined prompt suitable for language model 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 whole original history (except trailing tool calls).

System, User, Assistant, ToolCall1, ToolResult, ToolCall2 ->System, User, Memory, TLDR(System, User, Assistant, ToolCall1, ToolResult)

Functions

Link copied to clipboard
open suspend override fun compress(llmSession: AIAgentLLMWriteSession, memoryMessages: List<Message>)

Compresses and adjusts the prompt for the agent's writing session by summarizing and incorporating memory messages optionally.