Edgewise API
    Preparing search index...

    Module worker

    Run Edgewise in a Web Worker so model loading and inference never block the page.

    In a worker file:

    import { serveWorker } from 'edgewise/worker';
    serveWorker();

    On the page:

    import { connectWorker } from 'edgewise/worker';
    const ew = connectWorker(new Worker(new URL('./edgewise.worker.ts', import.meta.url), { type: 'module' }));
    for await (const delta of ew.generate({ model: 'text:default', input: 'Hi' })) out.append(delta);

    The page-side object has the same verbs and options as the main package. Streams, events, cancel, progress, tools (executed on the page), schemas (checked on the page), microphone sources and streamed text for speak() all cross the worker boundary.

    EdgewiseWorker
    connectWorker
    serveWorker