UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

25 lines (24 loc) • 1.02 kB
/** * Deterministic pre-dispatch history truncation. * * Runs inside the shared context preflight, so one implementation bounds input * cost on every dispatch path: native Anthropic, the translated/SDK fallback * that serves Vertex, and native or bridged Codex. * * Deliberately provider-free. Summarizing history would add an outbound model * call to the very requests this exists to make cheaper, so reduction is pure * removal of the oldest complete units. */ import type { ProxyHistoryEstimate, ProxyHistoryTruncationResult } from "../types/index.js"; /** * Remove the oldest complete units until the estimate reaches `targetTokens`. * * Returns the body unchanged when there is nothing safe to remove. The newest * unit is always retained: it carries the turn being answered. */ export declare function truncateHistoryForBudget<T extends object>(args: { body: T; inputTokensEstimate: number; targetTokens: number; estimate: ProxyHistoryEstimate; }): ProxyHistoryTruncationResult<T>;