Class CustomToolInputFormat
-
- All Implemented Interfaces:
public final class CustomToolInputFormatThe input format for the custom tool. Default is unconstrained text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCustomToolInputFormat.VisitorAn interface that defines how to map each variant of CustomToolInputFormat to a value of type T.
public final classCustomToolInputFormat.GrammarA grammar defined by the user.
-
Method Summary
Modifier and Type Method Description final Optional<JsonValue>text()Unconstrained free-form text. final Optional<CustomToolInputFormat.Grammar>grammar()A grammar defined by the user. final BooleanisText()final BooleanisGrammar()final JsonValueasText()Unconstrained free-form text. final CustomToolInputFormat.GrammarasGrammar()A grammar defined by the user. final Optional<JsonValue>_json()final <T extends Any> Taccept(CustomToolInputFormat.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final CustomToolInputFormatvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static CustomToolInputFormatofText()Unconstrained free-form text. final static CustomToolInputFormatofGrammar(CustomToolInputFormat.Grammar grammar)A grammar defined by the user. -
-
Method Detail
-
grammar
final Optional<CustomToolInputFormat.Grammar> grammar()
A grammar defined by the user.
-
asGrammar
final CustomToolInputFormat.Grammar asGrammar()
A grammar defined by the user.
-
accept
final <T extends Any> T accept(CustomToolInputFormat.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 = customToolInputFormat.accept(new CustomToolInputFormat.Visitor<Optional<String>>() { @Override public Optional<String> visitText(JsonValue text) { return Optional.of(text.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final CustomToolInputFormat 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 CustomToolInputFormat ofText()
Unconstrained free-form text.
-
ofGrammar
final static CustomToolInputFormat ofGrammar(CustomToolInputFormat.Grammar grammar)
A grammar defined by the user.
-
-
-
-