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.
events
const run = generate({ model: 'text:tiny', input: 'Hi' });for await (const delta of run) out.append(delta); // streamconst { usage } = await run; // then read the result Copy
const run = generate({ model: 'text:tiny', input: 'Hi' });for await (const delta of run) out.append(delta); // streamconst { usage } = await run; // then read the result
Optional
Every event, including tool calls, utterances and load progress.
The signal the run listens to.
Stop the run. Same as aborting the signal you passed.
Attaches callbacks for the resolution and/or rejection of the Promise.
The callback to execute when the Promise is resolved.
The callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
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.