Class AssistantToolChoiceOption
-
- All Implemented Interfaces:
public final class AssistantToolChoiceOptionControls which (if any) tool is called by the model.
nonemeans the model will not call any tools and instead generates a message.autois the default value and means the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools before responding to the user. Specifying a particular tool like{"type": "file_search"}or{"type": "function", "function": {"name": "my_function"}}forces the model to call that tool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceAssistantToolChoiceOption.VisitorAn interface that defines how to map each variant of AssistantToolChoiceOption to a value of type T.
public final classAssistantToolChoiceOption.Autononemeans the model will not call any tools and instead generates a message.automeans the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools before responding to the user.
-
Method Summary
Modifier and Type Method Description final Optional<AssistantToolChoiceOption.Auto>auto()nonemeans the model will not call any tools and instead generates a message.final Optional<AssistantToolChoice>assistantToolChoice()Specifies a tool the model should use. final BooleanisAuto()final BooleanisAssistantToolChoice()final AssistantToolChoiceOption.AutoasAuto()nonemeans the model will not call any tools and instead generates a message.final AssistantToolChoiceasAssistantToolChoice()Specifies a tool the model should use. final Optional<JsonValue>_json()final <T extends Any> Taccept(AssistantToolChoiceOption.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final AssistantToolChoiceOptionvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static AssistantToolChoiceOptionofAuto(AssistantToolChoiceOption.Auto auto)nonemeans the model will not call any tools and instead generates a message.final static AssistantToolChoiceOptionofAssistantToolChoice(AssistantToolChoice assistantToolChoice)Specifies a tool the model should use. -
-
Method Detail
-
auto
final Optional<AssistantToolChoiceOption.Auto> auto()
nonemeans the model will not call any tools and instead generates a message.automeans the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools before responding to the user.
-
assistantToolChoice
final Optional<AssistantToolChoice> assistantToolChoice()
Specifies a tool the model should use. Use to force the model to call a specific tool.
-
isAssistantToolChoice
final Boolean isAssistantToolChoice()
-
asAuto
final AssistantToolChoiceOption.Auto asAuto()
nonemeans the model will not call any tools and instead generates a message.automeans the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools before responding to the user.
-
asAssistantToolChoice
final AssistantToolChoice asAssistantToolChoice()
Specifies a tool the model should use. Use to force the model to call a specific tool.
-
accept
final <T extends Any> T accept(AssistantToolChoiceOption.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 = assistantToolChoiceOption.accept(new AssistantToolChoiceOption.Visitor<Optional<String>>() { @Override public Optional<String> visitAuto(Auto auto) { return Optional.of(auto.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final AssistantToolChoiceOption 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.
-
ofAuto
final static AssistantToolChoiceOption ofAuto(AssistantToolChoiceOption.Auto auto)
nonemeans the model will not call any tools and instead generates a message.automeans the model can pick between generating a message or calling one or more tools.requiredmeans the model must call one or more tools before responding to the user.
-
ofAssistantToolChoice
final static AssistantToolChoiceOption ofAssistantToolChoice(AssistantToolChoice assistantToolChoice)
Specifies a tool the model should use. Use to force the model to call a specific tool.
-
-
-
-