Skip to main content

Chunker

Trait Chunker 

Source
pub trait Chunker: Send + Sync {
    // Required method
    fn chunk(&self, document: &Document) -> Vec<Chunk>;
}
Available on crate feature rag only.
Expand description

A strategy for splitting documents into chunks.

Implementations produce Chunks with text and metadata but no embeddings. Embeddings are attached later by the pipeline.

Required Methods§

Source

fn chunk(&self, document: &Document) -> Vec<Chunk>

Split a document into chunks.

Returns an empty Vec if the document has empty text. Each returned chunk has an empty embedding vector.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§