import { AssistantStreamEvent } from "https://deno.land/x/openai@v4.31.0/resources/beta/mod.ts";
Interfaces
Occurs when an error occurs. This can happen due to an internal server error or a timeout. | |
Occurs when a new thread is created. | |
Occurs when a message is completed. | |
Occurs when a message is created. | |
Occurs when parts of a Message are being streamed. | |
Occurs when a message ends before it is completed. | |
Occurs when a
message moves
to an | |
Occurs when a run is cancelled. | |
Occurs when a run
moves to a | |
Occurs when a run is completed. | |
Occurs when a new run is created. | |
Occurs when a run expires. | |
Occurs when a run fails. | |
Occurs when a run
moves to an | |
Occurs when a run
moves to a | |
Occurs when a run
moves to a | |
Occurs when a run step is cancelled. | |
Occurs when a run step is completed. | |
Occurs when a run step is created. | |
Occurs when parts of a run step are being streamed. | |
Occurs when a run step expires. | |
Occurs when a run step fails. | |
Occurs when a
run step
moves to an |
import { type AssistantStreamEvent } from "https://deno.land/x/openai@v4.31.0/resources/beta/mod.ts";
Represents an event emitted when streaming a Run.
Each event in a server-sent events stream has an event
and data
property:
event: thread.created
data: {"id": "thread_123", "object": "thread", ...}
We emit events whenever a new object is created, transitions to a new state, or
is being streamed in parts (deltas). For example, we emit thread.run.created
when a new run is created, thread.run.completed
when a run completes, and so
on. When an Assistant chooses to create a message during a run, we emit a
thread.message.created event
, a thread.message.in_progress
event, many
thread.message.delta
events, and finally a thread.message.completed
event.
We may add additional events over time, so we recommend handling unknown events gracefully in your code. See the Assistants API quickstart to learn how to integrate the Assistants API with streaming.