kmp-domain 0.1.5

Domain model of the Kernel Memory Protocol: aggregates, value objects, repositories and projections, with no IO
Documentation
1
2
3
4
5
6
7
8
9
10
/// Estimates token counts for text content.
///
/// Implementations may range from simple heuristics (chars / 4) to
/// model-specific tokenizers. The kernel uses this trait for budget
/// enforcement during context rendering.
pub trait TokenEstimator: Send + Sync {
    fn estimate_tokens(&self, text: &str) -> u32;

    fn name(&self) -> &str;
}