pub struct ContextLimit {
pub max_tokens: usize,
pub reserved_response_tokens: usize,
pub chars_per_token: usize,
}Expand description
Configuration for estimating context usage.
Fields§
§max_tokens: usizeMaximum tokens available in the session context window.
reserved_response_tokens: usizeTokens reserved for the model’s next response.
chars_per_token: usizeEstimated characters per token (English ~3-4, CJK ~1).
Implementations§
Source§impl ContextLimit
impl ContextLimit
Sourcepub fn default_on_device() -> Self
pub fn default_on_device() -> Self
Creates a default configuration for on-device models.
Sourcepub fn with_reserved_response_tokens(self, tokens: usize) -> Self
pub fn with_reserved_response_tokens(self, tokens: usize) -> Self
Sets the reserved response tokens.
Sourcepub fn with_chars_per_token(self, chars: usize) -> Self
pub fn with_chars_per_token(self, chars: usize) -> Self
Sets the character-per-token estimate.
Trait Implementations§
Source§impl Clone for ContextLimit
impl Clone for ContextLimit
Source§fn clone(&self) -> ContextLimit
fn clone(&self) -> ContextLimit
Returns a duplicate of the value. Read more
1.0.0 · 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 ContextLimit
impl Debug for ContextLimit
impl Copy for ContextLimit
Auto Trait Implementations§
impl Freeze for ContextLimit
impl RefUnwindSafe for ContextLimit
impl Send for ContextLimit
impl Sync for ContextLimit
impl Unpin for ContextLimit
impl UnwindSafe for ContextLimit
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