Class BetaResponsesClientEvent

  • All Implemented Interfaces:

    
    public final class BetaResponsesClientEvent
    
                        

    Client events accepted by the Responses WebSocket server.

    • Constructor Detail

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

        • stream is implicit over WebSocket and should not be sent.

        • background is 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.

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

        • stream is implicit over WebSocket and should not be sent.

        • background is 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.

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