@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
30 lines (29 loc) • 1.53 kB
JavaScript
/**
* Decision inference types — typed, calibrated judgements from a model that
* emits no text.
*
* `decide` is the third inference type, alongside `generate` and `stream`. A
* decision model takes one `state` plus a map of named typed questions and
* returns one typed answer per question, all evaluated in a single parallel
* pass. TypeSafe's Jev is the first such model; Vercel's AI SDK models the
* same class separately from `LanguageModelV4`, for the same reason.
*
* The vocabulary here is deliberately **provider-neutral**. TypeSafe calls a
* yes/no question a `noul` and answers it in a field of the same name; both
* the Vercel AI SDK and Pydantic AI independently renamed that to `boolean` /
* `probability` when exposing it. This file follows them, and the mapping to
* a vendor's wire format belongs in that vendor's provider.
*
* Names are domain-prefixed `Decision*` to stay globally unique across
* `src/lib/types/` (CLAUDE.md rule 9). Note `evaluate`/`Evaluation*` is a
* different, unrelated feature — scoring a generated response with RAGAS.
*/
/** Default bound on a `DecisionHooks` callback, in milliseconds. */
export const DEFAULT_DECISION_HOOK_TIMEOUT_MS = 2000;
/**
* Largest `hookTimeoutMs` a timer honours (2^31 − 1 ms, about 24.8 days).
* A delay past it — or `Infinity`, `NaN`, 0, a negative — fires at once,
* so such a value falls back to the default instead of timing every hook
* out immediately.
*/
export const MAX_DECISION_HOOK_TIMEOUT_MS = 2_147_483_647;