@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
17 lines (16 loc) • 1.01 kB
TypeScript
/**
* Shared embeddings-response validation for Voyage and Jina — both call
* POST /embeddings with an identical `{input, model}` body and get back an
* identical `{data: [{embedding, index}]}` shape, and both had byte-identical
* validation logic (same three message templates, same sort-by-index +
* 0..n-1 coverage check) before this was factored out.
*
* A plain function, not a shared base class: Voyage throws typed
* `ProviderError` here, Jina throws plain `Error` (a real, pre-existing
* inconsistency between the two — not something this refactor silently
* fixes). `makeError` preserves each provider's exact existing behavior;
* `providerLabel` preserves each provider's exact existing message text
* ("Voyage ..." / "Jina ...").
*/
export declare const isFiniteEmbeddingVector: (value: unknown) => value is number[];
export declare function parseIndexedEmbeddingsResponse(data: unknown, inputCount: number, providerLabel: string, makeError: (message: string) => Error): number[][];