pub struct Chunker {
pub size: usize,
pub overlap: f32,
pub unit: ChunkUnit,
}Expand description
A configured Markdown chunker.
Fields§
§size: usizeTarget chunk size, measured in units (default 300).
overlap: f32Fractional overlap between consecutive chunks (default 0.05 = 5%).
unit: ChunkUnitThe unit size/overlap are measured in.
Implementations§
Source§impl Chunker
impl Chunker
Sourcepub fn from_config(cfg: &RagConfig) -> Self
pub fn from_config(cfg: &RagConfig) -> Self
Build a chunker from the resolved config.
Sourcepub fn chunk(&self, doc_id: &str, markdown: &str) -> Vec<Chunk>
pub fn chunk(&self, doc_id: &str, markdown: &str) -> Vec<Chunk>
Chunk a Markdown document into Chunks owned by doc_id.
Implemented over StreamingChunker so batch and streaming ingestion
share one code path (and cannot diverge).
Sourcepub fn streaming(&self, doc_id: &str) -> StreamingChunker
pub fn streaming(&self, doc_id: &str) -> StreamingChunker
Start an incremental chunking session for one document. Feed Markdown
pieces with StreamingChunker::push as they arrive from the parser and
collect completed chunks immediately; call StreamingChunker::finish
after the last piece.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chunker
impl RefUnwindSafe for Chunker
impl Send for Chunker
impl Sync for Chunker
impl Unpin for Chunker
impl UnsafeUnpin for Chunker
impl UnwindSafe for Chunker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().