pub struct ContextPack {
pub token_budget: u32,
pub fragments: Vec<ContextFragment>,
}Expand description
A bounded prompt/context bundle.
Fields§
§token_budget: u32Maximum allowed prompt tokens for this pack.
fragments: Vec<ContextFragment>Context fragments selected for the next model call.
Implementations§
Source§impl ContextPack
impl ContextPack
Sourcepub fn estimated_tokens(&self) -> u32
pub fn estimated_tokens(&self) -> u32
Sums fragment estimates, saturating at u32::MAX.
Sourcepub fn validate_budget(&self) -> Result<(), Error>
pub fn validate_budget(&self) -> Result<(), Error>
Rejects a fragment sum that exceeds the declared token budget.
Trait Implementations§
Source§impl Clone for ContextPack
impl Clone for ContextPack
Source§fn clone(&self) -> ContextPack
fn clone(&self) -> ContextPack
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 ContextPack
impl Debug for ContextPack
Source§impl<'de> Deserialize<'de> for ContextPack
impl<'de> Deserialize<'de> for ContextPack
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 ContextPack
Source§impl PartialEq for ContextPack
impl PartialEq for ContextPack
Source§impl Serialize for ContextPack
impl Serialize for ContextPack
impl StructuralPartialEq for ContextPack
Auto Trait Implementations§
impl Freeze for ContextPack
impl RefUnwindSafe for ContextPack
impl Send for ContextPack
impl Sync for ContextPack
impl Unpin for ContextPack
impl UnsafeUnpin for ContextPack
impl UnwindSafe for ContextPack
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