@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
26 lines (25 loc) • 1.13 kB
TypeScript
/**
* Image format detection from magic bytes.
*
* The native Vertex+Anthropic image block needs the correct `mimeType` for
* each inline image. Buffer and bare-base64 inputs (e.g. Slack / REST uploads)
* carry no mime hint, so the format must be sniffed from the leading bytes —
* otherwise a wrong default (historically `image/jpeg`) makes Anthropic reject
* PNG/GIF/WebP with a media-type mismatch 400.
*/
/**
* Detect an image's MIME type from its magic bytes, or `null` when the bytes
* match no known signature.
*
* Use this when the answer "not an image" has to be distinguishable from a
* default. `detectImageMimeType` collapses that distinction on purpose, which
* is right for a caller that already knows it holds an image and wrong for one
* deciding whether it does.
*/
export declare function sniffImageMimeType(buffer: Buffer): string | null;
/**
* Detect an image's MIME type from its magic bytes. Returns `image/png` for
* buffers that match no known signature (the safest neutral default for the
* Vertex image path).
*/
export declare function detectImageMimeType(buffer: Buffer): string;