@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
56 lines (55 loc) • 1.65 kB
TypeScript
/**
* Image Loader for Multi-Modal RAG
*
* Loads image files (from disk or URLs) into ImageDocument objects
* that can be embedded and stored in a vector store alongside text chunks.
*
* @example
* ```typescript
* import { ImageLoader } from './imageLoader.js';
*
* const loader = new ImageLoader();
*
* // Load from file path
* const doc = await loader.load('./photo.jpg');
*
* // Load from URL
* const doc2 = await loader.load('https://example.com/image.png');
*
* // Load from buffer
* const doc3 = loader.loadFromBuffer(imageBuffer, 'image/jpeg');
* ```
*/
import type { ImageDocument, ImageLoaderOptions } from "../../types/index.js";
/**
* ImageLoader for multi-modal RAG.
* Loads images from file paths, URLs, or buffers into ImageDocument objects.
*/
export declare class ImageLoader {
private options;
constructor(options?: ImageLoaderOptions);
/**
* Load an image from a file path or URL.
*/
load(source: string, options?: Partial<ImageLoaderOptions>): Promise<ImageDocument>;
/**
* Load an image from a local file path.
*/
private loadFromPath;
/**
* Load an image from a URL.
*/
private loadFromURL;
/**
* Load an image directly from a Buffer.
*/
loadFromBuffer(buffer: Buffer, mimeType: string, source?: string, options?: Partial<ImageLoaderOptions>): ImageDocument;
/**
* Check if a file path or extension is a supported image format.
*/
static isImageFile(source: string): boolean;
/**
* Get the MIME type for a file extension.
*/
static getMimeType(filePath: string): string | undefined;
}