Class RealtimeToolChoiceConfig
-
- All Implemented Interfaces:
public final class RealtimeToolChoiceConfigHow the model chooses tools. Provide one of the string modes or force a specific function/MCP tool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceRealtimeToolChoiceConfig.VisitorAn interface that defines how to map each variant of RealtimeToolChoiceConfig to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ToolChoiceOptions>toolChoiceOptions()Controls which (if any) tool is called by the model. final Optional<ToolChoiceFunction>toolChoiceFunction()Use this option to force the model to call a specific function. final Optional<ToolChoiceMcp>toolChoiceMcp()Use this option to force the model to call a specific tool on a remote MCP server. final BooleanisToolChoiceOptions()final BooleanisToolChoiceFunction()final BooleanisToolChoiceMcp()final ToolChoiceOptionsasToolChoiceOptions()Controls which (if any) tool is called by the model. final ToolChoiceFunctionasToolChoiceFunction()Use this option to force the model to call a specific function. final ToolChoiceMcpasToolChoiceMcp()Use this option to force the model to call a specific tool on a remote MCP server. final Optional<JsonValue>_json()final <T extends Any> Taccept(RealtimeToolChoiceConfig.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final RealtimeToolChoiceConfigvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static RealtimeToolChoiceConfigofToolChoiceOptions(ToolChoiceOptions toolChoiceOptions)Controls which (if any) tool is called by the model. final static RealtimeToolChoiceConfigofToolChoiceFunction(ToolChoiceFunction toolChoiceFunction)Use this option to force the model to call a specific function. final static RealtimeToolChoiceConfigofToolChoiceMcp(ToolChoiceMcp toolChoiceMcp)Use this option to force the model to call a specific tool on a remote MCP server. -
-
Method Detail
-
toolChoiceOptions
final Optional<ToolChoiceOptions> toolChoiceOptions()
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.
-
toolChoiceFunction
final Optional<ToolChoiceFunction> toolChoiceFunction()
Use this option to force the model to call a specific function.
-
toolChoiceMcp
final Optional<ToolChoiceMcp> toolChoiceMcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
isToolChoiceOptions
final Boolean isToolChoiceOptions()
-
isToolChoiceFunction
final Boolean isToolChoiceFunction()
-
isToolChoiceMcp
final Boolean isToolChoiceMcp()
-
asToolChoiceOptions
final ToolChoiceOptions asToolChoiceOptions()
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.
-
asToolChoiceFunction
final ToolChoiceFunction asToolChoiceFunction()
Use this option to force the model to call a specific function.
-
asToolChoiceMcp
final ToolChoiceMcp asToolChoiceMcp()
Use this option to force the model to call a specific tool on a remote MCP server.
-
accept
final <T extends Any> T accept(RealtimeToolChoiceConfig.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 = realtimeToolChoiceConfig.accept(new RealtimeToolChoiceConfig.Visitor<Optional<String>>() { @Override public Optional<String> visitToolChoiceOptions(ToolChoiceOptions toolChoiceOptions) { return Optional.of(toolChoiceOptions.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final RealtimeToolChoiceConfig 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.
-
ofToolChoiceOptions
final static RealtimeToolChoiceConfig ofToolChoiceOptions(ToolChoiceOptions toolChoiceOptions)
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.
-
ofToolChoiceFunction
final static RealtimeToolChoiceConfig ofToolChoiceFunction(ToolChoiceFunction toolChoiceFunction)
Use this option to force the model to call a specific function.
-
ofToolChoiceMcp
final static RealtimeToolChoiceConfig ofToolChoiceMcp(ToolChoiceMcp toolChoiceMcp)
Use this option to force the model to call a specific tool on a remote MCP server.
-
-
-
-