Class RunStreamEvent
-
- All Implemented Interfaces:
public final class RunStreamEventOccurs when a new run is created.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRunStreamEvent.VisitorAn interface that defines how to map each variant of RunStreamEvent to a value of type T.
public final classRunStreamEvent.ThreadRunCreatedOccurs when a new run is created.
public final classRunStreamEvent.ThreadRunQueuedOccurs when a run moves to a
queuedstatus.public final classRunStreamEvent.ThreadRunInProgressOccurs when a run moves to an
in_progressstatus.public final classRunStreamEvent.ThreadRunRequiresActionOccurs when a run moves to a
requires_actionstatus.public final classRunStreamEvent.ThreadRunCompletedOccurs when a run is completed.
public final classRunStreamEvent.ThreadRunIncompleteOccurs when a run ends with status
incomplete.public final classRunStreamEvent.ThreadRunFailedOccurs when a run fails.
public final classRunStreamEvent.ThreadRunCancellingOccurs when a run moves to a
cancellingstatus.public final classRunStreamEvent.ThreadRunCancelledOccurs when a run is cancelled.
public final classRunStreamEvent.ThreadRunExpiredOccurs when a run expires.
-
Method Summary
-
-
Method Detail
-
threadRunCreated
final Optional<RunStreamEvent.ThreadRunCreated> threadRunCreated()
Occurs when a new run is created.
-
threadRunQueued
final Optional<RunStreamEvent.ThreadRunQueued> threadRunQueued()
Occurs when a run moves to a
queuedstatus.
-
threadRunInProgress
final Optional<RunStreamEvent.ThreadRunInProgress> threadRunInProgress()
Occurs when a run moves to an
in_progressstatus.
-
threadRunRequiresAction
final Optional<RunStreamEvent.ThreadRunRequiresAction> threadRunRequiresAction()
Occurs when a run moves to a
requires_actionstatus.
-
threadRunCompleted
final Optional<RunStreamEvent.ThreadRunCompleted> threadRunCompleted()
Occurs when a run is completed.
-
threadRunIncomplete
final Optional<RunStreamEvent.ThreadRunIncomplete> threadRunIncomplete()
Occurs when a run ends with status
incomplete.
-
threadRunFailed
final Optional<RunStreamEvent.ThreadRunFailed> threadRunFailed()
Occurs when a run fails.
-
threadRunCancelling
final Optional<RunStreamEvent.ThreadRunCancelling> threadRunCancelling()
Occurs when a run moves to a
cancellingstatus.
-
threadRunCancelled
final Optional<RunStreamEvent.ThreadRunCancelled> threadRunCancelled()
Occurs when a run is cancelled.
-
threadRunExpired
final Optional<RunStreamEvent.ThreadRunExpired> threadRunExpired()
Occurs when a run expires.
-
isThreadRunCreated
final Boolean isThreadRunCreated()
-
isThreadRunQueued
final Boolean isThreadRunQueued()
-
isThreadRunInProgress
final Boolean isThreadRunInProgress()
-
isThreadRunRequiresAction
final Boolean isThreadRunRequiresAction()
-
isThreadRunCompleted
final Boolean isThreadRunCompleted()
-
isThreadRunIncomplete
final Boolean isThreadRunIncomplete()
-
isThreadRunFailed
final Boolean isThreadRunFailed()
-
isThreadRunCancelling
final Boolean isThreadRunCancelling()
-
isThreadRunCancelled
final Boolean isThreadRunCancelled()
-
isThreadRunExpired
final Boolean isThreadRunExpired()
-
asThreadRunCreated
final RunStreamEvent.ThreadRunCreated asThreadRunCreated()
Occurs when a new run is created.
-
asThreadRunQueued
final RunStreamEvent.ThreadRunQueued asThreadRunQueued()
Occurs when a run moves to a
queuedstatus.
-
asThreadRunInProgress
final RunStreamEvent.ThreadRunInProgress asThreadRunInProgress()
Occurs when a run moves to an
in_progressstatus.
-
asThreadRunRequiresAction
final RunStreamEvent.ThreadRunRequiresAction asThreadRunRequiresAction()
Occurs when a run moves to a
requires_actionstatus.
-
asThreadRunCompleted
final RunStreamEvent.ThreadRunCompleted asThreadRunCompleted()
Occurs when a run is completed.
-
asThreadRunIncomplete
final RunStreamEvent.ThreadRunIncomplete asThreadRunIncomplete()
Occurs when a run ends with status
incomplete.
-
asThreadRunFailed
final RunStreamEvent.ThreadRunFailed asThreadRunFailed()
Occurs when a run fails.
-
asThreadRunCancelling
final RunStreamEvent.ThreadRunCancelling asThreadRunCancelling()
Occurs when a run moves to a
cancellingstatus.
-
asThreadRunCancelled
final RunStreamEvent.ThreadRunCancelled asThreadRunCancelled()
Occurs when a run is cancelled.
-
asThreadRunExpired
final RunStreamEvent.ThreadRunExpired asThreadRunExpired()
Occurs when a run expires.
-
accept
final <T extends Any> T accept(RunStreamEvent.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = runStreamEvent.accept(new RunStreamEvent.Visitor<Optional<String>>() { @Override public Optional<String> visitThreadRunCreated(ThreadRunCreated threadRunCreated) { return Optional.of(threadRunCreated.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RunStreamEvent validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofThreadRunCreated
final static RunStreamEvent ofThreadRunCreated(RunStreamEvent.ThreadRunCreated threadRunCreated)
Occurs when a new run is created.
-
ofThreadRunQueued
final static RunStreamEvent ofThreadRunQueued(RunStreamEvent.ThreadRunQueued threadRunQueued)
Occurs when a run moves to a
queuedstatus.
-
ofThreadRunInProgress
final static RunStreamEvent ofThreadRunInProgress(RunStreamEvent.ThreadRunInProgress threadRunInProgress)
Occurs when a run moves to an
in_progressstatus.
-
ofThreadRunRequiresAction
final static RunStreamEvent ofThreadRunRequiresAction(RunStreamEvent.ThreadRunRequiresAction threadRunRequiresAction)
Occurs when a run moves to a
requires_actionstatus.
-
ofThreadRunCompleted
final static RunStreamEvent ofThreadRunCompleted(RunStreamEvent.ThreadRunCompleted threadRunCompleted)
Occurs when a run is completed.
-
ofThreadRunIncomplete
final static RunStreamEvent ofThreadRunIncomplete(RunStreamEvent.ThreadRunIncomplete threadRunIncomplete)
Occurs when a run ends with status
incomplete.
-
ofThreadRunFailed
final static RunStreamEvent ofThreadRunFailed(RunStreamEvent.ThreadRunFailed threadRunFailed)
Occurs when a run fails.
-
ofThreadRunCancelling
final static RunStreamEvent ofThreadRunCancelling(RunStreamEvent.ThreadRunCancelling threadRunCancelling)
Occurs when a run moves to a
cancellingstatus.
-
ofThreadRunCancelled
final static RunStreamEvent ofThreadRunCancelled(RunStreamEvent.ThreadRunCancelled threadRunCancelled)
Occurs when a run is cancelled.
-
ofThreadRunExpired
final static RunStreamEvent ofThreadRunExpired(RunStreamEvent.ThreadRunExpired threadRunExpired)
Occurs when a run expires.
-
-
-
-