Class InputTokenCountParams.ToolChoice
-
- All Implemented Interfaces:
public final class InputTokenCountParams.ToolChoiceControls which tool the model should use, if any.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceInputTokenCountParams.ToolChoice.VisitorAn interface that defines how to map each variant of ToolChoice to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaToolChoiceOptions>betaToolChoiceOptions()Controls which (if any) tool is called by the model. final Optional<BetaToolChoiceAllowed>betaToolChoiceAllowed()Constrains the tools available to the model to a pre-defined set. final Optional<BetaToolChoiceTypes>betaToolChoiceTypes()Indicates that the model should use a built-in tool to generate a response. final Optional<BetaToolChoiceFunction>betaToolChoiceFunction()Use this option to force the model to call a specific function. final Optional<BetaToolChoiceMcp>betaToolChoiceMcp()Use this option to force the model to call a specific tool on a remote MCP server. final Optional<BetaToolChoiceCustom>betaToolChoiceCustom()Use this option to force the model to call a specific custom tool. final Optional<JsonValue>betaSpecificProgrammaticToolCallingParam()final Optional<BetaToolChoiceApplyPatch>betaToolChoiceApplyPatch()Forces the model to call the apply_patch tool when executing a tool call. final Optional<BetaToolChoiceShell>betaToolChoiceShell()Forces the model to call the shell tool when a tool call is required. final BooleanisBetaToolChoiceOptions()final BooleanisBetaToolChoiceAllowed()final BooleanisBetaToolChoiceTypes()final BooleanisBetaToolChoiceFunction()final BooleanisBetaToolChoiceMcp()final BooleanisBetaToolChoiceCustom()final BooleanisBetaSpecificProgrammaticToolCallingParam()final BooleanisBetaToolChoiceApplyPatch()final BooleanisBetaToolChoiceShell()final BetaToolChoiceOptionsasBetaToolChoiceOptions()Controls which (if any) tool is called by the model. final BetaToolChoiceAllowedasBetaToolChoiceAllowed()Constrains the tools available to the model to a pre-defined set. final BetaToolChoiceTypesasBetaToolChoiceTypes()Indicates that the model should use a built-in tool to generate a response. final BetaToolChoiceFunctionasBetaToolChoiceFunction()Use this option to force the model to call a specific function. final BetaToolChoiceMcpasBetaToolChoiceMcp()Use this option to force the model to call a specific tool on a remote MCP server. final BetaToolChoiceCustomasBetaToolChoiceCustom()Use this option to force the model to call a specific custom tool. final JsonValueasBetaSpecificProgrammaticToolCallingParam()final BetaToolChoiceApplyPatchasBetaToolChoiceApplyPatch()Forces the model to call the apply_patch tool when executing a tool call. final BetaToolChoiceShellasBetaToolChoiceShell()Forces the model to call the shell tool when a tool call is required. final Optional<JsonValue>_json()final <T extends Any> Taccept(InputTokenCountParams.ToolChoice.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final InputTokenCountParams.ToolChoicevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static InputTokenCountParams.ToolChoiceofBetaToolChoiceOptions(BetaToolChoiceOptions betaToolChoiceOptions)Controls which (if any) tool is called by the model. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceAllowed(BetaToolChoiceAllowed betaToolChoiceAllowed)Constrains the tools available to the model to a pre-defined set. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceTypes(BetaToolChoiceTypes betaToolChoiceTypes)Indicates that the model should use a built-in tool to generate a response. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceFunction(BetaToolChoiceFunction betaToolChoiceFunction)Use this option to force the model to call a specific function. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceMcp(BetaToolChoiceMcp betaToolChoiceMcp)Use this option to force the model to call a specific tool on a remote MCP server. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceCustom(BetaToolChoiceCustom betaToolChoiceCustom)Use this option to force the model to call a specific custom tool. final static InputTokenCountParams.ToolChoiceofBetaSpecificProgrammaticToolCallingParam()final static InputTokenCountParams.ToolChoiceofBetaToolChoiceApplyPatch(BetaToolChoiceApplyPatch betaToolChoiceApplyPatch)Forces the model to call the apply_patch tool when executing a tool call. final static InputTokenCountParams.ToolChoiceofBetaToolChoiceShell(BetaToolChoiceShell betaToolChoiceShell)Forces the model to call the shell tool when a tool call is required. -
-
Method Detail
-
betaToolChoiceOptions
final Optional<BetaToolChoiceOptions> betaToolChoiceOptions()
Controls which (if any) tool is called by the model.
nonemeans the model will not call any tool 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.
-
betaToolChoiceAllowed
final Optional<BetaToolChoiceAllowed> betaToolChoiceAllowed()
Constrains the tools available to the model to a pre-defined set.
-
betaToolChoiceTypes
final Optional<BetaToolChoiceTypes> betaToolChoiceTypes()
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
betaToolChoiceFunction
final Optional<BetaToolChoiceFunction> betaToolChoiceFunction()
Use this option to force the model to call a specific function.
-
betaToolChoiceMcp
final Optional<BetaToolChoiceMcp> betaToolChoiceMcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
betaToolChoiceCustom
final Optional<BetaToolChoiceCustom> betaToolChoiceCustom()
Use this option to force the model to call a specific custom tool.
-
betaSpecificProgrammaticToolCallingParam
final Optional<JsonValue> betaSpecificProgrammaticToolCallingParam()
-
betaToolChoiceApplyPatch
final Optional<BetaToolChoiceApplyPatch> betaToolChoiceApplyPatch()
Forces the model to call the apply_patch tool when executing a tool call.
-
betaToolChoiceShell
final Optional<BetaToolChoiceShell> betaToolChoiceShell()
Forces the model to call the shell tool when a tool call is required.
-
isBetaToolChoiceOptions
final Boolean isBetaToolChoiceOptions()
-
isBetaToolChoiceAllowed
final Boolean isBetaToolChoiceAllowed()
-
isBetaToolChoiceTypes
final Boolean isBetaToolChoiceTypes()
-
isBetaToolChoiceFunction
final Boolean isBetaToolChoiceFunction()
-
isBetaToolChoiceMcp
final Boolean isBetaToolChoiceMcp()
-
isBetaToolChoiceCustom
final Boolean isBetaToolChoiceCustom()
-
isBetaSpecificProgrammaticToolCallingParam
final Boolean isBetaSpecificProgrammaticToolCallingParam()
-
isBetaToolChoiceApplyPatch
final Boolean isBetaToolChoiceApplyPatch()
-
isBetaToolChoiceShell
final Boolean isBetaToolChoiceShell()
-
asBetaToolChoiceOptions
final BetaToolChoiceOptions asBetaToolChoiceOptions()
Controls which (if any) tool is called by the model.
nonemeans the model will not call any tool 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.
-
asBetaToolChoiceAllowed
final BetaToolChoiceAllowed asBetaToolChoiceAllowed()
Constrains the tools available to the model to a pre-defined set.
-
asBetaToolChoiceTypes
final BetaToolChoiceTypes asBetaToolChoiceTypes()
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
asBetaToolChoiceFunction
final BetaToolChoiceFunction asBetaToolChoiceFunction()
Use this option to force the model to call a specific function.
-
asBetaToolChoiceMcp
final BetaToolChoiceMcp asBetaToolChoiceMcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
asBetaToolChoiceCustom
final BetaToolChoiceCustom asBetaToolChoiceCustom()
Use this option to force the model to call a specific custom tool.
-
asBetaSpecificProgrammaticToolCallingParam
final JsonValue asBetaSpecificProgrammaticToolCallingParam()
-
asBetaToolChoiceApplyPatch
final BetaToolChoiceApplyPatch asBetaToolChoiceApplyPatch()
Forces the model to call the apply_patch tool when executing a tool call.
-
asBetaToolChoiceShell
final BetaToolChoiceShell asBetaToolChoiceShell()
Forces the model to call the shell tool when a tool call is required.
-
accept
final <T extends Any> T accept(InputTokenCountParams.ToolChoice.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 = toolChoice.accept(new ToolChoice.Visitor<Optional<String>>() { @Override public Optional<String> visitBetaToolChoiceOptions(BetaToolChoiceOptions betaToolChoiceOptions) { return Optional.of(betaToolChoiceOptions.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final InputTokenCountParams.ToolChoice 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.
-
ofBetaToolChoiceOptions
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceOptions(BetaToolChoiceOptions betaToolChoiceOptions)
Controls which (if any) tool is called by the model.
nonemeans the model will not call any tool 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.
-
ofBetaToolChoiceAllowed
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceAllowed(BetaToolChoiceAllowed betaToolChoiceAllowed)
Constrains the tools available to the model to a pre-defined set.
-
ofBetaToolChoiceTypes
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceTypes(BetaToolChoiceTypes betaToolChoiceTypes)
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
ofBetaToolChoiceFunction
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceFunction(BetaToolChoiceFunction betaToolChoiceFunction)
Use this option to force the model to call a specific function.
-
ofBetaToolChoiceMcp
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceMcp(BetaToolChoiceMcp betaToolChoiceMcp)
Use this option to force the model to call a specific tool on a remote MCP server.
-
ofBetaToolChoiceCustom
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceCustom(BetaToolChoiceCustom betaToolChoiceCustom)
Use this option to force the model to call a specific custom tool.
-
ofBetaSpecificProgrammaticToolCallingParam
final static InputTokenCountParams.ToolChoice ofBetaSpecificProgrammaticToolCallingParam()
-
ofBetaToolChoiceApplyPatch
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceApplyPatch(BetaToolChoiceApplyPatch betaToolChoiceApplyPatch)
Forces the model to call the apply_patch tool when executing a tool call.
-
ofBetaToolChoiceShell
final static InputTokenCountParams.ToolChoice ofBetaToolChoiceShell(BetaToolChoiceShell betaToolChoiceShell)
Forces the model to call the shell tool when a tool call is required.
-
-
-
-