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

29 lines (28 loc) • 1.59 kB
import type { NativeGenerateGuardConfig } from "../types/index.js"; /** V3-shape adapter for the reclaim policy shared with streaming guards. */ export declare function createNativeGenerateGuard(config: NativeGenerateGuardConfig): { /** * Record the prompt-token count the vendor reported for the step just * sent. * * Paired with the estimate this guard made for that same step it yields a * calibration ratio — how far the local estimator undercounts what the * vendor actually charges — and that ratio scales the reclaim threshold, * so the guard fires against real token accounting rather than its own. * A non-finite or non-positive figure is ignored, leaving calibration at * 1 rather than skewing it toward a number the vendor never reported. */ observeUsage(usage: unknown): void; /** * Reclaim context from `conversation` when it has crossed the guard's * threshold, or return `undefined` to send it unchanged. * * The initial task prefix — every message up to and including the first * user turn — is protected as a unit, so leading system messages cannot * displace the task itself from entry zero. Only the entries strictly * between that prefix and the newest `DEFAULT_LOOP_GUARD_PROTECTED_TAIL` * are eligible for truncation or dropping under the shared reclaim * policy; that protected tail — the live working set — is left intact. */ guardConversation(conversation: Array<Record<string, unknown>>): Array<Record<string, unknown>> | undefined; };