Expand description
Cache-aware compression decisions using provider billing economics (#1195).
Compression of an already-sent prompt prefix can turn cheap cache reads into cache writes. This module compares that penalty with the actual token reduction and chooses the candidate with the highest expected USD benefit.
Structs§
Enums§
Functions§
- decide
- Compare candidates using all provider input token classes affected here.
- predict_
session_ length - Deterministic session-length estimate used when no explicit forecast exists. Short sessions retain a small horizon; established long sessions reserve a further 50% of their current length for cache-reuse economics.
- prefix_
stability_ score - Ratio of the previous prefix preserved at the start of the current prefix. Appending content is perfectly stable; a mutation near the front scores low.