Skip to main content

token_split

Function token_split 

Source
pub fn token_split(messages: &[Message], keep_tokens: usize) -> usize
Expand description

Index at which the kept (verbatim) tail starts when keeping roughly the last keep_tokens tokens. The tail always starts on a plain user message (never between a tool call and its result) and keeps at least the last such message. Returns 0 when there is nothing older to summarize.