PromptVault.Compaction behaviour (PromptVault v0.1.0)

View Source

Behaviour for compaction strategy implementations.

Compaction strategies are used to reduce the number of messages in a context while preserving important information, typically to manage token limits.

Summary

Callbacks

Compacts the given context using the strategy's algorithm.

Types

t()

@type t() :: term()

Callbacks

compact(context, opts)

@callback compact(context :: PromptVault.Context.t(), opts :: keyword()) ::
  {:ok, PromptVault.Context.t()} | {:error, reason :: any()}

Compacts the given context using the strategy's algorithm.

Returns a new context with fewer messages, or an error if compaction fails.