Edgewise API
    Preparing search index...

    Class Run<Result, Chunk>

    A Run is both a promise of the final result and an async iterable of chunks. It starts when you first await it, iterate it, or read events.

    const run = generate({ model: 'text:tiny', input: 'Hi' });
    for await (const delta of run) out.append(delta); // stream
    const { usage } = await run; // then read the result

    Type Parameters

    • Result
    • Chunk

    Implements

    Index
    • get events(): AsyncIterable<RunEvent>

      Every event, including tool calls, utterances and load progress.

      Returns AsyncIterable<RunEvent>

    • get signal(): AbortSignal

      The signal the run listens to.

      Returns AbortSignal

    • Returns AsyncIterator<Chunk>

    • Stop the run. Same as aborting the signal you passed.

      Parameters

      • Optionalreason: unknown

      Returns void

    • Type Parameters

      • B = never

      Parameters

      • Optionalonrejected: ((reason: unknown) => B | PromiseLike<B>) | null

      Returns Promise<Result | B>

    • Parameters

      • Optionalfn: (() => void) | null

      Returns Promise<Result>

    • Attaches callbacks for the resolution and/or rejection of the Promise.

      Type Parameters

      Parameters

      • Optionalonfulfilled: ((value: Result) => A | PromiseLike<A>) | null

        The callback to execute when the Promise is resolved.

      • Optionalonrejected: ((reason: unknown) => B | PromiseLike<B>) | null

        The callback to execute when the Promise is rejected.

      Returns Promise<A | B>

      A Promise for the completion of which ever callback is executed.