pub struct CompactionBudget {
pub context_tokens: u64,
pub reserved_output_tokens: u64,
pub max_input_tokens: u64,
pub max_input_bytes: u64,
}Expand description
Hard provider-context boundary used by one compaction decision.
Fields§
§context_tokens: u64Provider-declared context-window size.
reserved_output_tokens: u64Tokens reserved for the provider response.
max_input_tokens: u64Maximum deterministic fallback token estimate available to the input prompt.
max_input_bytes: u64Independent serialized-byte ceiling for the input prompt.
Implementations§
Source§impl CompactionBudget
impl CompactionBudget
Sourcepub fn new(
context_tokens: u64,
reserved_output_tokens: u64,
max_input_bytes: u64,
) -> Result<Self, CompactionError>
pub fn new( context_tokens: u64, reserved_output_tokens: u64, max_input_bytes: u64, ) -> Result<Self, CompactionError>
Creates a budget whose input allowance is the provider window minus the response reserve.
Sourcepub fn validate(&self) -> Result<(), CompactionError>
pub fn validate(&self) -> Result<(), CompactionError>
Validates the arithmetic and byte boundary committed by this budget.
Trait Implementations§
Source§impl Clone for CompactionBudget
impl Clone for CompactionBudget
Source§fn clone(&self) -> CompactionBudget
fn clone(&self) -> CompactionBudget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompactionBudget
impl Debug for CompactionBudget
Source§impl<'de> Deserialize<'de> for CompactionBudget
impl<'de> Deserialize<'de> for CompactionBudget
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CompactionBudget
Source§impl PartialEq for CompactionBudget
impl PartialEq for CompactionBudget
Source§impl Serialize for CompactionBudget
impl Serialize for CompactionBudget
impl StructuralPartialEq for CompactionBudget
Auto Trait Implementations§
impl Freeze for CompactionBudget
impl RefUnwindSafe for CompactionBudget
impl Send for CompactionBudget
impl Sync for CompactionBudget
impl Unpin for CompactionBudget
impl UnsafeUnpin for CompactionBudget
impl UnwindSafe for CompactionBudget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more