pub trait ChunkSizer {
    // Required method
    fn chunk_size(&self, chunk: &str) -> usize;
}
Expand description

Determines the size of a given chunk.

Required Methods§

source

fn chunk_size(&self, chunk: &str) -> usize

Determine the size of a given chunk to use for validation

Implementations on Foreign Types§

source§

impl ChunkSizer for CoreBPE

Available on crate feature tiktoken-rs only.
source§

fn chunk_size(&self, text: &str) -> usize

Returns the number of tokens in a given text after tokenization.

Panics

Will panic if you don’t have a byte-level tokenizer and the splitter encounters text it can’t tokenize.

source§

impl ChunkSizer for Tokenizer

Available on crate feature tokenizers only.
source§

fn chunk_size(&self, chunk: &str) -> usize

Returns the number of tokens in a given text after tokenization.

Panics

Will panic if you don’t have a byte-level tokenizer and the splitter encounters text it can’t tokenize.

Implementors§