Class ResponseCreateParams.Input
-
- All Implemented Interfaces:
public final class ResponseCreateParams.InputText, image, or file inputs to the model, used to generate a response.
Learn more:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseCreateParams.Input.VisitorAn interface that defines how to map each variant of Input to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>text()A text input to the model, equivalent to a text input with the userrole.final Optional<List<ResponseInputItem>>response()A list of one or many input items to the model, containing different content types. final BooleanisText()final BooleanisResponse()final StringasText()A text input to the model, equivalent to a text input with the userrole.final List<ResponseInputItem>asResponse()A list of one or many input items to the model, containing different content types. final Optional<JsonValue>_json()final <T extends Any> Taccept(ResponseCreateParams.Input.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ResponseCreateParams.Inputvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ResponseCreateParams.InputofText(String text)A text input to the model, equivalent to a text input with the userrole.final static ResponseCreateParams.InputofResponse(List<ResponseInputItem> response)A list of one or many input items to the model, containing different content types. -
-
Method Detail
-
text
final Optional<String> text()
A text input to the model, equivalent to a text input with the
userrole.
-
response
final Optional<List<ResponseInputItem>> response()
A list of one or many input items to the model, containing different content types.
-
isResponse
final Boolean isResponse()
-
asText
final String asText()
A text input to the model, equivalent to a text input with the
userrole.
-
asResponse
final List<ResponseInputItem> asResponse()
A list of one or many input items to the model, containing different content types.
-
accept
final <T extends Any> T accept(ResponseCreateParams.Input.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 = input.accept(new Input.Visitor<Optional<String>>() { @Override public Optional<String> visitText(String text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseCreateParams.Input 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.
-
ofText
final static ResponseCreateParams.Input ofText(String text)
A text input to the model, equivalent to a text input with the
userrole.
-
ofResponse
final static ResponseCreateParams.Input ofResponse(List<ResponseInputItem> response)
A list of one or many input items to the model, containing different content types.
-
-
-
-