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.22 kB
import type { DecisionOptions, DecisionResult } from "../types/index.js"; /** * How many batches of one split request are in flight at once. A request that * splits into many must not meet the vendor's rate limit first: Perplexity, for * one, allows ten requests a second. */ export declare const MAX_PARALLEL_DECISION_BATCHES = 4; /** * Cut a request whose question map is longer than a provider's cap into * requests the provider takes, keeping the questions in the order they were * given. A request that fits, or a provider with no cap, comes back as the one * request it was. * * `state` and any images or video travel with every batch, since each batch is * a decision of its own. */ export declare function splitDecisionRequest(options: DecisionOptions, maxQuestions: number | undefined): DecisionOptions[]; /** * One result from the results of several batches: the answers joined, usage and * media summed, the latency of the slowest (the batches ran side by side), and * the request ids listed. Model and provider are the first batch's, which is * the same for all of them. */ export declare function mergeDecisionResults(results: readonly [DecisionResult, ...DecisionResult[]]): DecisionResult;