Class BetaResponsesClientEvent
-
- All Implemented Interfaces:
public final class BetaResponsesClientEventClient events accepted by the Responses WebSocket server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaResponsesClientEvent.VisitorAn interface that defines how to map each variant of BetaResponsesClientEvent to a value of type T.
public final classBetaResponsesClientEvent.ResponseCreateClient event for creating a response over a persistent WebSocket connection. This payload uses the same top-level fields as
POST /v1/responses.Notes:
streamis implicit over WebSocket and should not be sent.backgroundis not supported over WebSocket.
-
Method Summary
Modifier and Type Method Description final Optional<BetaResponsesClientEvent.ResponseCreate>responseCreate()Client event for creating a response over a persistent WebSocket connection. final Optional<BetaResponseInjectEvent>responseInject()Injects input items into an active response over a WebSocket connection. final BooleanisResponseCreate()final BooleanisResponseInject()final BetaResponsesClientEvent.ResponseCreateasResponseCreate()Client event for creating a response over a persistent WebSocket connection. final BetaResponseInjectEventasResponseInject()Injects input items into an active response over a WebSocket connection. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaResponsesClientEvent.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaResponsesClientEventvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaResponsesClientEventofResponseCreate(BetaResponsesClientEvent.ResponseCreate responseCreate)Client event for creating a response over a persistent WebSocket connection. final static BetaResponsesClientEventofResponseInject(BetaResponseInjectEvent responseInject)Injects input items into an active response over a WebSocket connection. -
-
Method Detail
-
responseCreate
final Optional<BetaResponsesClientEvent.ResponseCreate> responseCreate()
Client event for creating a response over a persistent WebSocket connection. This payload uses the same top-level fields as
POST /v1/responses.Notes:
streamis implicit over WebSocket and should not be sent.backgroundis not supported over WebSocket.
-
responseInject
final Optional<BetaResponseInjectEvent> responseInject()
Injects input items into an active response over a WebSocket connection. The items are validated and committed atomically. Currently, the server accepts client-owned tool outputs that resume a waiting agent.
-
isResponseCreate
final Boolean isResponseCreate()
-
isResponseInject
final Boolean isResponseInject()
-
asResponseCreate
final BetaResponsesClientEvent.ResponseCreate asResponseCreate()
Client event for creating a response over a persistent WebSocket connection. This payload uses the same top-level fields as
POST /v1/responses.Notes:
streamis implicit over WebSocket and should not be sent.backgroundis not supported over WebSocket.
-
asResponseInject
final BetaResponseInjectEvent asResponseInject()
Injects input items into an active response over a WebSocket connection. The items are validated and committed atomically. Currently, the server accepts client-owned tool outputs that resume a waiting agent.
-
accept
final <T extends Any> T accept(BetaResponsesClientEvent.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 = betaResponsesClientEvent.accept(new BetaResponsesClientEvent.Visitor<Optional<String>>() { @Override public Optional<String> visitResponseCreate(ResponseCreate responseCreate) { return Optional.of(responseCreate.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaResponsesClientEvent 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.
-
ofResponseCreate
final static BetaResponsesClientEvent ofResponseCreate(BetaResponsesClientEvent.ResponseCreate responseCreate)
Client event for creating a response over a persistent WebSocket connection. This payload uses the same top-level fields as
POST /v1/responses.Notes:
streamis implicit over WebSocket and should not be sent.backgroundis not supported over WebSocket.
-
ofResponseInject
final static BetaResponsesClientEvent ofResponseInject(BetaResponseInjectEvent responseInject)
Injects input items into an active response over a WebSocket connection. The items are validated and committed atomically. Currently, the server accepts client-owned tool outputs that resume a waiting agent.
-
-
-
-