pub fn truncate_history(
body: &mut Value,
limit_chars: usize,
) -> Result<TruncationReport, TruncationError>Expand description
Trim stale history in place so the request fits within limit_chars.
limit_chars is the total payload character budget for this request. See
the module documentation for the full algorithm.
ยงErrors
TruncationError::ExceedsBudgetAfterTruncation when the payload still
exceeds the budget after every eligible message has been trimmed. body is
left in its trimmed state; callers reject the request rather than forward it.