Class Response.Instructions
-
- All Implemented Interfaces:
public final class Response.InstructionsA system (or developer) message inserted into the model's context.
When using along with
previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponse.Instructions.VisitorAn interface that defines how to map each variant of Instructions 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 developerrole.final Optional<List<ResponseInputItem>>inputItemList()A list of one or many input items to the model, containing different content types. final BooleanisString()final BooleanisInputItemList()final StringasString()A text input to the model, equivalent to a text input with the developerrole.final List<ResponseInputItem>asInputItemList()A list of one or many input items to the model, containing different content types. final Optional<JsonValue>_json()final <T extends Any> Taccept(Response.Instructions.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final Response.Instructionsvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static Response.InstructionsofString(String string)A text input to the model, equivalent to a text input with the developerrole.final static Response.InstructionsofInputItemList(List<ResponseInputItem> inputItemList)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
developerrole.
-
inputItemList
final Optional<List<ResponseInputItem>> inputItemList()
A list of one or many input items to the model, containing different content types.
-
isInputItemList
final Boolean isInputItemList()
-
asString
final String asString()
A text input to the model, equivalent to a text input with the
developerrole.
-
asInputItemList
final List<ResponseInputItem> asInputItemList()
A list of one or many input items to the model, containing different content types.
-
accept
final <T extends Any> T accept(Response.Instructions.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 = instructions.accept(new Instructions.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 Response.Instructions 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 Response.Instructions ofString(String string)
A text input to the model, equivalent to a text input with the
developerrole.
-
ofInputItemList
final static Response.Instructions ofInputItemList(List<ResponseInputItem> inputItemList)
A list of one or many input items to the model, containing different content types.
-
-
-
-