pub struct ChunkingStrategy {
pub max_window_tokens: usize,
pub overlap_tokens: Vec<usize>,
pub summary_fallback_weight: f32,
pub summary_fallback_tokens: usize,
pub chunk_weight_floor: f32,
/* private fields */
}Expand description
Controls how long text sections are chunked and weighted.
Fields§
§max_window_tokens: usizeMax tokens per window when slicing a section into chunks.
overlap_tokens: Vec<usize>Overlap sizes (in tokens) used when sliding windows across a section.
summary_fallback_weight: f32Weight assigned to summary-fallback chunks (when generated).
summary_fallback_tokens: usizeMax tokens for summary-fallback chunks (0 disables fallback chunks).
chunk_weight_floor: f32Floor applied to per-chunk weight after offset or summary fallback weighting.
Implementations§
Source§impl ChunkingStrategy
impl ChunkingStrategy
Sourcepub fn register_preprocessor(
&mut self,
p: impl TextPreprocessor + 'static,
) -> &mut Self
pub fn register_preprocessor( &mut self, p: impl TextPreprocessor + 'static, ) -> &mut Self
Register a crate::preprocessor::TextPreprocessor to run before chunking.
Preprocessors are applied in registration order; if any returns None
the section is dropped and produces no chunks.
Sourcepub fn preprocessors(&self) -> &[Arc<dyn TextPreprocessor>]
pub fn preprocessors(&self) -> &[Arc<dyn TextPreprocessor>]
Return the slice of registered preprocessors.
Trait Implementations§
Source§impl Clone for ChunkingStrategy
impl Clone for ChunkingStrategy
Source§impl Debug for ChunkingStrategy
impl Debug for ChunkingStrategy
Auto Trait Implementations§
impl Freeze for ChunkingStrategy
impl !RefUnwindSafe for ChunkingStrategy
impl Send for ChunkingStrategy
impl Sync for ChunkingStrategy
impl Unpin for ChunkingStrategy
impl UnsafeUnpin for ChunkingStrategy
impl !UnwindSafe for ChunkingStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more