Class ResponseCreateParams.ToolChoice
-
- All Implemented Interfaces:
public final class ResponseCreateParams.ToolChoiceHow the model should select which tool (or tools) to use when generating a response. See the
toolsparameter to see how to specify which tools the model can call.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseCreateParams.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<ToolChoiceOptions>options()Controls which (if any) tool is called by the model. final Optional<ToolChoiceAllowed>allowed()Constrains the tools available to the model to a pre-defined set. final Optional<ToolChoiceTypes>types()Indicates that the model should use a built-in tool to generate a response. final Optional<ToolChoiceFunction>function()Use this option to force the model to call a specific function. final Optional<ToolChoiceMcp>mcp()Use this option to force the model to call a specific tool on a remote MCP server. final Optional<ToolChoiceCustom>custom()Use this option to force the model to call a specific custom tool. final BooleanisOptions()final BooleanisAllowed()final BooleanisTypes()final BooleanisFunction()final BooleanisMcp()final BooleanisCustom()final ToolChoiceOptionsasOptions()Controls which (if any) tool is called by the model. final ToolChoiceAllowedasAllowed()Constrains the tools available to the model to a pre-defined set. final ToolChoiceTypesasTypes()Indicates that the model should use a built-in tool to generate a response. final ToolChoiceFunctionasFunction()Use this option to force the model to call a specific function. final ToolChoiceMcpasMcp()Use this option to force the model to call a specific tool on a remote MCP server. final ToolChoiceCustomasCustom()Use this option to force the model to call a specific custom tool. final Optional<JsonValue>_json()final <T extends Any> Taccept(ResponseCreateParams.ToolChoice.Visitor<T> visitor)final ResponseCreateParams.ToolChoicevalidate()final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ResponseCreateParams.ToolChoiceofOptions(ToolChoiceOptions options)Controls which (if any) tool is called by the model. final static ResponseCreateParams.ToolChoiceofAllowed(ToolChoiceAllowed allowed)Constrains the tools available to the model to a pre-defined set. final static ResponseCreateParams.ToolChoiceofTypes(ToolChoiceTypes types)Indicates that the model should use a built-in tool to generate a response. final static ResponseCreateParams.ToolChoiceofFunction(ToolChoiceFunction function)Use this option to force the model to call a specific function. final static ResponseCreateParams.ToolChoiceofMcp(ToolChoiceMcp mcp)Use this option to force the model to call a specific tool on a remote MCP server. final static ResponseCreateParams.ToolChoiceofCustom(ToolChoiceCustom custom)Use this option to force the model to call a specific custom tool. -
-
Method Detail
-
options
final Optional<ToolChoiceOptions> options()
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.
-
allowed
final Optional<ToolChoiceAllowed> allowed()
Constrains the tools available to the model to a pre-defined set.
-
types
final Optional<ToolChoiceTypes> types()
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
function
final Optional<ToolChoiceFunction> function()
Use this option to force the model to call a specific function.
-
mcp
final Optional<ToolChoiceMcp> mcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
custom
final Optional<ToolChoiceCustom> custom()
Use this option to force the model to call a specific custom tool.
-
isFunction
final Boolean isFunction()
-
asOptions
final ToolChoiceOptions asOptions()
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.
-
asAllowed
final ToolChoiceAllowed asAllowed()
Constrains the tools available to the model to a pre-defined set.
-
asTypes
final ToolChoiceTypes asTypes()
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
asFunction
final ToolChoiceFunction asFunction()
Use this option to force the model to call a specific function.
-
asMcp
final ToolChoiceMcp asMcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
asCustom
final ToolChoiceCustom asCustom()
Use this option to force the model to call a specific custom tool.
-
accept
final <T extends Any> T accept(ResponseCreateParams.ToolChoice.Visitor<T> visitor)
-
validate
final ResponseCreateParams.ToolChoice validate()
-
ofOptions
final static ResponseCreateParams.ToolChoice ofOptions(ToolChoiceOptions options)
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.
-
ofAllowed
final static ResponseCreateParams.ToolChoice ofAllowed(ToolChoiceAllowed allowed)
Constrains the tools available to the model to a pre-defined set.
-
ofTypes
final static ResponseCreateParams.ToolChoice ofTypes(ToolChoiceTypes types)
Indicates that the model should use a built-in tool to generate a response. Learn more about built-in tools.
-
ofFunction
final static ResponseCreateParams.ToolChoice ofFunction(ToolChoiceFunction function)
Use this option to force the model to call a specific function.
-
ofMcp
final static ResponseCreateParams.ToolChoice ofMcp(ToolChoiceMcp mcp)
Use this option to force the model to call a specific tool on a remote MCP server.
-
ofCustom
final static ResponseCreateParams.ToolChoice ofCustom(ToolChoiceCustom custom)
Use this option to force the model to call a specific custom tool.
-
-
-
-