Skip to main content

Function: image()

image(img): UnifiedMessageInput

Defined in: packages/core/src/multimodal.ts:181

Create an image input (single image or array).

Image data can be a base64 string, Uint8Array, Blob, or an HTTPS URL string. HTTPS URLs are fetched server-side by the AI provider — zero memory overhead. Set cacheControl: true on the MediaImage to enable provider-side caching.

Parameters

img

MediaImage | MediaImage[]

Returns

UnifiedMessageInput

Examples

bot.process(image({ data: 'https://cdn.example.com/receipt.jpg', mediaType: 'image/jpeg', cacheControl: true }));
bot.process(image({ data: imgBuffer, mediaType: 'image/png' }));