pub struct PromptBudget { /* private fields */ }Expand description
Exact byte and conservative token limits for one compiled prompt.
Implementations§
Source§impl PromptBudget
impl PromptBudget
Sourcepub fn new(
max_bytes: usize,
max_estimated_tokens: usize,
) -> Result<Self, ContextError>
pub fn new( max_bytes: usize, max_estimated_tokens: usize, ) -> Result<Self, ContextError>
Creates non-zero bounded prompt limits.
§Errors
Returns an error for zero values or limits above 16 MiB / safe integer.
Sourcepub const fn max_estimated_tokens(self) -> usize
pub const fn max_estimated_tokens(self) -> usize
Returns conservative estimated-token limit.
Trait Implementations§
Source§impl Clone for PromptBudget
impl Clone for PromptBudget
Source§fn clone(&self) -> PromptBudget
fn clone(&self) -> PromptBudget
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 moreimpl Copy for PromptBudget
Source§impl Debug for PromptBudget
impl Debug for PromptBudget
impl Eq for PromptBudget
Source§impl PartialEq for PromptBudget
impl PartialEq for PromptBudget
impl StructuralPartialEq for PromptBudget
Auto Trait Implementations§
impl Freeze for PromptBudget
impl RefUnwindSafe for PromptBudget
impl Send for PromptBudget
impl Sync for PromptBudget
impl Unpin for PromptBudget
impl UnsafeUnpin for PromptBudget
impl UnwindSafe for PromptBudget
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