pub struct ChunkConfig {
pub max_tokens: usize,
pub overlap_tokens: usize,
pub min_tokens: usize,
pub encoding: String,
pub preserve_paragraphs: bool,
}Expand description
Chunker configuration.
Fields§
§max_tokens: usizeHard cap on tokens per chunk.
overlap_tokens: usizeNumber of trailing tokens of each chunk re-prepended to the next. Set to 0 to disable overlap.
min_tokens: usizeDrop chunks shorter than this.
encoding: StringEncoding name (cl100k_base or o200k_base).
preserve_paragraphs: boolTreat blank-line-separated paragraphs as hard boundaries: never
pack content from two paragraphs into the same chunk, even if the
budget allows it. Default: false (the historical behavior).
Useful for documents with semantically distinct sections.
Trait Implementations§
Source§impl Clone for ChunkConfig
impl Clone for ChunkConfig
Source§fn clone(&self) -> ChunkConfig
fn clone(&self) -> ChunkConfig
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 moreSource§impl Debug for ChunkConfig
impl Debug for ChunkConfig
Source§impl Default for ChunkConfig
impl Default for ChunkConfig
Source§impl<'de> Deserialize<'de> for ChunkConfig
impl<'de> Deserialize<'de> for ChunkConfig
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
Source§impl PartialEq for ChunkConfig
impl PartialEq for ChunkConfig
Source§fn eq(&self, other: &ChunkConfig) -> bool
fn eq(&self, other: &ChunkConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ChunkConfig
impl Serialize for ChunkConfig
impl Eq for ChunkConfig
impl StructuralPartialEq for ChunkConfig
Auto Trait Implementations§
impl Freeze for ChunkConfig
impl RefUnwindSafe for ChunkConfig
impl Send for ChunkConfig
impl Sync for ChunkConfig
impl Unpin for ChunkConfig
impl UnsafeUnpin for ChunkConfig
impl UnwindSafe for ChunkConfig
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> 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