Class ResponseCompactParams.Input
-
- All Implemented Interfaces:
public final class ResponseCompactParams.InputText, image, or file inputs to the model, used to generate a response
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseCompactParams.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>string()A text input to the model, equivalent to a text input with the userrole.final Optional<List<ResponseInputItem>>responseInputItems()A list of one or many input items to the model, containing different content types. final BooleanisString()final BooleanisResponseInputItems()final StringasString()A text input to the model, equivalent to a text input with the userrole.final List<ResponseInputItem>asResponseInputItems()A list of one or many input items to the model, containing different content types. final Optional<JsonValue>_json()final <T extends Any> Taccept(ResponseCompactParams.Input.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ResponseCompactParams.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 ResponseCompactParams.InputofString(String string)A text input to the model, equivalent to a text input with the userrole.final static ResponseCompactParams.InputofResponseInputItems(List<ResponseInputItem> responseInputItems)A list of one or many input items to the model, containing different content types. -
-
Method Detail
-
string
final Optional<String> string()
A text input to the model, equivalent to a text input with the
userrole.
-
responseInputItems
final Optional<List<ResponseInputItem>> responseInputItems()
A list of one or many input items to the model, containing different content types.
-
isResponseInputItems
final Boolean isResponseInputItems()
-
asString
final String asString()
A text input to the model, equivalent to a text input with the
userrole.
-
asResponseInputItems
final List<ResponseInputItem> asResponseInputItems()
A list of one or many input items to the model, containing different content types.
-
accept
final <T extends Any> T accept(ResponseCompactParams.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> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseCompactParams.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.
-
ofString
final static ResponseCompactParams.Input ofString(String string)
A text input to the model, equivalent to a text input with the
userrole.
-
ofResponseInputItems
final static ResponseCompactParams.Input ofResponseInputItems(List<ResponseInputItem> responseInputItems)
A list of one or many input items to the model, containing different content types.
-
-
-
-