edgewise v0.4.1

Message parts

Inputs are values, or parts that wrap them. Edgewise detects the type, checks it against the model's accepts list, and converts it for the model.

What you can pass#

You passBecomesWorks in
stringtexteverywhere
Blob / File with an image type, URL of an imageimageeverywhere (URL fetches)
{ data, width, height, channels } (RawPixels)imageeverywhere
HTMLImageElement, HTMLCanvasElement, ImageBitmap, ImageData, OffscreenCanvasimagebrowser
HTMLVideoElementimage (current frame), or video with a video partbrowser
Blob with an audio type, WAV bytesaudioeverywhere (other formats: browser)
Float32Arrayaudio at 16 kHzeverywhere
mic(), audioSource()live audiobrowser / everywhere

Explicit parts#

ts
await generate({
  model: 'vision:default',
  input: [
    { type: 'image', image: photo },
    { type: 'text', text: 'Describe this.' },
  ],
});

{ type: 'audio', audio: samples, sampleRate: 44100 } // resampled for you
{ type: 'video', video: videoEl, frames: 8 }         // browser: frames are sampled evenly

Accepts#

Every manifest lists its inputs:

ts
registry.get('lfm2.5-vl-450m').accepts;  // ['text', 'image']
registry.list({ verb: 'generate', accepts: 'audio' }); // speech models

Passing an image to a text-only model throws UnsupportedInputError before any download, with a hint listing models that accept images.

Audio decoding#

WAV files decode in every runtime. In the browser, other formats (MP3, Ogg, WebM, M4A) decode with Web Audio. On servers, convert other formats to WAV or pass raw samples.

Edgewise 0.4.1 · MIT licence · Edit this page