pub struct ContextWindowResult {
pub context: String,
pub used_tokens: usize,
pub included_chunks: usize,
pub truncated_chunks: usize,
pub dropped_chunks: usize,
pub chunk_tokens: Vec<usize>,
}Expand description
上下文窗口组装结果
Fields§
§context: String组装后的上下文文本
used_tokens: usize实际使用的 token 数
included_chunks: usize包含的片段数量
truncated_chunks: usize被截断的片段数量
dropped_chunks: usize被丢弃的片段数量
chunk_tokens: Vec<usize>每个片段的 token 数
Implementations§
Source§impl ContextWindowResult
impl ContextWindowResult
Sourcepub fn has_truncation(&self) -> bool
pub fn has_truncation(&self) -> bool
是否有任何片段被截断
Sourcepub fn utilization(&self, available: usize) -> f32
pub fn utilization(&self, available: usize) -> f32
利用率(已用 token / 可用 token)
Trait Implementations§
Source§impl Clone for ContextWindowResult
impl Clone for ContextWindowResult
Source§fn clone(&self) -> ContextWindowResult
fn clone(&self) -> ContextWindowResult
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 moreAuto Trait Implementations§
impl Freeze for ContextWindowResult
impl RefUnwindSafe for ContextWindowResult
impl Send for ContextWindowResult
impl Sync for ContextWindowResult
impl Unpin for ContextWindowResult
impl UnsafeUnpin for ContextWindowResult
impl UnwindSafe for ContextWindowResult
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