Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/memory / / allocateTokenBudget
Function: allocateTokenBudget()
ts
function allocateTokenBudget(
layers,
budgetTokens,
counter,
options?): Promise<AllocationResult>;Defined in: packages/memory/src/context-engine/token-budget.ts:153
Run the allocator. Layers are sorted by priority ascending (the first layer is the highest priority); when the running total exceeds the budget, lower-priority layers are first capped at their per-layer cap (when set) and finally truncated to whatever fits.
Parameters
| Parameter | Type |
|---|---|
layers | readonly LayerCandidate[] |
budgetTokens | number |
counter | ContextTokenCounter |
options | { overflowMode?: OverflowMode; priority?: readonly LayerId[]; } |
options.overflowMode? | OverflowMode |
options.priority? | readonly LayerId[] |
Returns
Promise<AllocationResult>