compressHistory

expect open suspend override fun compressHistory(strategy: HistoryCompressionStrategy, preserveMemory: Boolean)(source)

Compresses the current LLM prompt (message history) into a summary, replacing messages with a TLDR.

Return

The input value, unchanged.

Parameters

input

The input value that will be returned unchanged after compression.

strategy

Determines which messages to include in compression.

preserveMemory

Specifies whether to retain message memory after compression.

fun <ToolArg, ToolResult> compressHistory(strategy: HistoryCompressionStrategy = HistoryCompressionStrategy.WholeHistory, preserveMemory: Boolean = true, executorService: ERROR CLASS: Symbol not found for ExecutorService?? = null)(source)

Compresses the historical data of a tool's operations using the specified compression strategy. This method is designed for optimizing memory usage by reducing the size of stored historical data.

Return

Unit

Parameters

strategy

the strategy to use for compressing the history, defaults to the whole history compression strategy

preserveMemory

a flag indicating whether to prioritize memory preservation during compression, defaults to true

executorService

an optional executor service to perform the operation asynchronously, defaults to null