pub struct ContextWindow {
pub max_tokens: usize,
pub response_reserve: usize,
pub system_reserve: usize,
pub history_minimum: usize,
}
Expand description
Context window configuration and management
Fields§
§max_tokens: usize
Maximum tokens in context window
response_reserve: usize
Reserved tokens for the response
system_reserve: usize
Reserved tokens for system message
history_minimum: usize
Minimum tokens to keep from conversation history
Implementations§
Source§impl ContextWindow
impl ContextWindow
Sourcepub fn available_for_history(&self) -> usize
pub fn available_for_history(&self) -> usize
Get available tokens for conversation history
Sourcepub fn tokens_to_truncate(&self, current_tokens: usize) -> usize
pub fn tokens_to_truncate(&self, current_tokens: usize) -> usize
Calculate how many tokens to truncate
Trait Implementations§
Source§impl Clone for ContextWindow
impl Clone for ContextWindow
Source§fn clone(&self) -> ContextWindow
fn clone(&self) -> ContextWindow
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 ContextWindow
impl Debug for ContextWindow
Source§impl<'de> Deserialize<'de> for ContextWindow
impl<'de> Deserialize<'de> for ContextWindow
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
Auto Trait Implementations§
impl Freeze for ContextWindow
impl RefUnwindSafe for ContextWindow
impl Send for ContextWindow
impl Sync for ContextWindow
impl Unpin for ContextWindow
impl UnwindSafe for ContextWindow
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