Hierarchy

  • EventStream<AssistantStreamEvents>
    • AssistantStream

Implements

Constructors

  • Returns AssistantStream

Properties

controller: AbortController

Accessors

  • get aborted(): boolean
  • Returns boolean

  • get ended(): boolean
  • Returns boolean

  • get errored(): boolean
  • Returns boolean

Methods

  • Returns AsyncIterator<AssistantStreamEvent, any, undefined>

  • Returns void

  • Returns undefined | RunStep

  • Returns Promise<void>

  • 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 AssistantStreamEvents

    Parameters

    Returns Promise<EventParameters<AssistantStreamEvents, Event> extends [Param]
        ? Param
        : EventParameters<AssistantStreamEvents, Event> extends []
            ? void
            : EventParameters<AssistantStreamEvents, 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

  • Returns Promise<RunStep[]>

  • Removes the specified listener from the listener array for the event. off() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified event, then off() must be called multiple times to remove each instance.

    Type Parameters

    • Event extends keyof AssistantStreamEvents

    Parameters

    • event: Event
    • listener: EventListener<AssistantStreamEvents, Event>

    Returns this

    this ChatCompletionStream, so that calls can be chained

  • Adds the listener function to the end of the listeners array for the event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.

    Type Parameters

    • Event extends keyof AssistantStreamEvents

    Parameters

    • event: Event
    • listener: EventListener<AssistantStreamEvents, Event>

    Returns this

    this ChatCompletionStream, so that calls can be chained

  • Adds a one-time listener function for the event. The next time the event is triggered, this listener is removed and then invoked.

    Type Parameters

    • Event extends keyof AssistantStreamEvents

    Parameters

    • event: Event
    • listener: EventListener<AssistantStreamEvents, Event>

    Returns this

    this ChatCompletionStream, so that calls can be chained

  • Returns ReadableStream<any>

  • Parameters

    • acc: Record<string, any>
    • delta: Record<string, any>

    Returns Record<string, any>

  • Parameters

    • params: ThreadCreateAndRunParamsBaseStream
    • thread: Threads
    • Optionaloptions: RequestOptions

    Returns AssistantStream

  • Parameters

    • threadId: string
    • runId: string
    • runs: OpenAIClient.Beta.Threads.Runs
    • params: RunSubmitToolOutputsParamsStream
    • options: undefined | RequestOptions

    Returns AssistantStream

  • Parameters

    • stream: ReadableStream<any>

    Returns AssistantStream