Skip to content

Graphorin API reference v0.4.0


Graphorin API reference / @graphorin/memory / / adaptTokenCounter

Function: adaptTokenCounter()

ts
function adaptTokenCounter(counter): ContextTokenCounter;

Defined in: packages/memory/src/context-engine/token-counter.ts:54

Wrap a real TokenCounter into the narrower ContextTokenCounter surface. Calls countText(text) directly for max precision; falls back to the synthetic single-message bridge when only count(messages) is supported.

Parameters

ParameterType
counterTokenCounter

Returns

ContextTokenCounter

Stable