Class AssistantStreamEvent

java.lang.Object
com.azure.core.util.ExpandableStringEnum<AssistantStreamEvent>
com.azure.ai.openai.assistants.models.AssistantStreamEvent
All Implemented Interfaces:
com.azure.core.util.ExpandableEnum<String>

public final class AssistantStreamEvent extends com.azure.core.util.ExpandableStringEnum<AssistantStreamEvent>
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.
  • Field Details

    • THREAD_CREATED

      public static final AssistantStreamEvent THREAD_CREATED
      Event sent when a new thread is created. The data of this event is of type AssistantThread.
    • THREAD_RUN_CREATED

      public static final AssistantStreamEvent THREAD_RUN_CREATED
      Event sent when a new run is created. The data of this event is of type ThreadRun.
    • THREAD_RUN_QUEUED

      public static final AssistantStreamEvent THREAD_RUN_QUEUED
      Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun.
    • THREAD_RUN_IN_PROGRESS

      public static final AssistantStreamEvent THREAD_RUN_IN_PROGRESS
      Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun.
    • THREAD_RUN_REQUIRES_ACTION

      public static final AssistantStreamEvent THREAD_RUN_REQUIRES_ACTION
      Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun.
    • THREAD_RUN_COMPLETED

      public static final AssistantStreamEvent THREAD_RUN_COMPLETED
      Event sent when a run is completed. The data of this event is of type ThreadRun.
    • THREAD_RUN_FAILED

      public static final AssistantStreamEvent THREAD_RUN_FAILED
      Event sent when a run fails. The data of this event is of type ThreadRun.
    • THREAD_RUN_CANCELLING

      public static final AssistantStreamEvent THREAD_RUN_CANCELLING
      Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun.
    • THREAD_RUN_CANCELLED

      public static final AssistantStreamEvent THREAD_RUN_CANCELLED
      Event sent when a run is cancelled. The data of this event is of type ThreadRun.
    • THREAD_RUN_EXPIRED

      public static final AssistantStreamEvent THREAD_RUN_EXPIRED
      Event sent when a run is expired. The data of this event is of type ThreadRun.
    • THREAD_RUN_STEP_CREATED

      public static final AssistantStreamEvent THREAD_RUN_STEP_CREATED
      Event sent when a new thread run step is created. The data of this event is of type RunStep.
    • THREAD_RUN_STEP_IN_PROGRESS

      public static final AssistantStreamEvent THREAD_RUN_STEP_IN_PROGRESS
      Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep.
    • THREAD_RUN_STEP_DELTA

      public static final AssistantStreamEvent THREAD_RUN_STEP_DELTA
      Event sent when a run stepis being streamed. The data of this event is of type RunStepDeltaChunk.
    • THREAD_RUN_STEP_COMPLETED

      public static final AssistantStreamEvent THREAD_RUN_STEP_COMPLETED
      Event sent when a run step is completed. The data of this event is of type RunStep.
    • THREAD_RUN_STEP_FAILED

      public static final AssistantStreamEvent THREAD_RUN_STEP_FAILED
      Event sent when a run step fails. The data of this event is of type RunStep.
    • THREAD_RUN_STEP_CANCELLED

      public static final AssistantStreamEvent THREAD_RUN_STEP_CANCELLED
      Event sent when a run step is cancelled. The data of this event is of type RunStep.
    • THREAD_RUN_STEP_EXPIRED

      public static final AssistantStreamEvent THREAD_RUN_STEP_EXPIRED
      Event sent when a run step is expired. The data of this event is of type RunStep.
    • THREAD_MESSAGE_CREATED

      public static final AssistantStreamEvent THREAD_MESSAGE_CREATED
      Event sent when a new message is created. The data of this event is of type ThreadMessage.
    • THREAD_MESSAGE_IN_PROGRESS

      public static final AssistantStreamEvent THREAD_MESSAGE_IN_PROGRESS
      Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage.
    • THREAD_MESSAGE_DELTA

      public static final AssistantStreamEvent THREAD_MESSAGE_DELTA
      Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk.
    • THREAD_MESSAGE_COMPLETED

      public static final AssistantStreamEvent THREAD_MESSAGE_COMPLETED
      Event sent when a message is completed. The data of this event is of type ThreadMessage.
    • THREAD_MESSAGE_INCOMPLETE

      public static final AssistantStreamEvent THREAD_MESSAGE_INCOMPLETE
      Event sent before a message is completed. The data of this event is of type ThreadMessage.
    • ERROR

      public static final AssistantStreamEvent ERROR
      Event sent when an error occurs, such as an internal server error or a timeout.
    • DONE

      public static final AssistantStreamEvent DONE
      Event sent when the stream is done.
  • Constructor Details

    • AssistantStreamEvent

      @Deprecated public AssistantStreamEvent()
      Deprecated.
      Use the fromString(String) factory method.
      Creates a new instance of AssistantStreamEvent value.
  • Method Details

    • fromString

      public static AssistantStreamEvent fromString(String name)
      Creates or finds a AssistantStreamEvent from its string representation.
      Parameters:
      name - a name to look for.
      Returns:
      the corresponding AssistantStreamEvent.
    • values

      public static Collection<AssistantStreamEvent> values()
      Gets known AssistantStreamEvent values.
      Returns:
      known AssistantStreamEvent values.