Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/openai/lib/AbstractAssistantStreamRunner.ts>AbstractAssistantStreamRunner#emitted

Deno build of the official Typescript library for the OpenAI API.
Extremely Popular
Go to Latest
method AbstractAssistantStreamRunner.prototype.emitted
import { AbstractAssistantStreamRunner } from "https://deno.land/x/openai@v4.41.1/lib/AbstractAssistantStreamRunner.ts";

This is similar to .once(), but returns a Promise that resolves the next time the event is triggered, instead of calling a listener callback.

Type Parameters

Event extends keyof Events

Returns

Promise<EventParameters<Events, Event> extends [infer Param] ? Param : EventParameters<Events, Event> extends [] ? void : EventParameters<Events, Event>>

a Promise that resolves the next time given event is triggered, or rejects if an error is emitted. (If you request the 'error' event, returns a promise that resolves with the error).

Example:

const message = await stream.emitted('message') // rejects if the stream errors