Skip to content
1 min read · 100 words

Interface: Estimable

Defined in: src/batteries/context/thrift/contracts.ts:67

Anything that can estimate its own rendered token cost under a named encoding — the structural shape the battery expects from a Tokenizable-like value (system prompt, standing instruction, message content, thought content). Mirrors core's Tokenizable public surface, minimally.

Methods

estimateTokens()

ts
estimateTokens(encoding: string, ctx?: unknown): number;

Defined in: src/batteries/context/thrift/contracts.ts:72

Estimate this value's rendered token cost under encoding, optionally resolved against a live dispatch context (see EstimateTokensFn for why ctx matters for dynamic content).

Parameters

ParameterType
encodingstring
ctx?unknown

Returns

number