PhoenixAI.Store.Memory.Strategies.TokenTruncation (PhoenixAI.Store v0.1.0)

Copy Markdown View Source

A memory strategy that removes oldest messages until the total token count fits within a budget.

Sums tokens from newest to oldest, keeping the newest messages that fit.

Options

  • :max_tokens - the maximum token budget (required)

Token counting

Uses token_count from the message struct when available. Falls back to the token counter provided in context (:token_counter) or PhoenixAI.Store.Memory.TokenCounter.Default.

Priority

Returns 200.