Class ToolChoiceAllowed
-
- All Implemented Interfaces:
public final class ToolChoiceAllowed
Constrains the tools available to the model to a pre-defined set.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ToolChoiceAllowed.Builder
A builder for ToolChoiceAllowed.
public final class
ToolChoiceAllowed.Mode
Constrains the tools available to the model to a pre-defined set.
auto
allows the model to pick from among the allowed tools and generate a message.required
requires the model to call one or more of the allowed tools.public final class
ToolChoiceAllowed.Tool
A tool definition that the model should be allowed to call.
-
Method Summary
Modifier and Type Method Description final ToolChoiceAllowed.Mode
mode()
Constrains the tools available to the model to a pre-defined set. final List<ToolChoiceAllowed.Tool>
tools()
A list of tool definitions that the model should be allowed to call. final JsonValue
_type()
Allowed tool configuration type. final JsonField<ToolChoiceAllowed.Mode>
_mode()
Returns the raw JSON value of mode. final JsonField<List<ToolChoiceAllowed.Tool>>
_tools()
Returns the raw JSON value of tools. final Map<String, JsonValue>
_additionalProperties()
final ToolChoiceAllowed.Builder
toBuilder()
final ToolChoiceAllowed
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ToolChoiceAllowed.Builder
builder()
Returns a mutable builder for constructing an instance of ToolChoiceAllowed. -
-
Method Detail
-
mode
final ToolChoiceAllowed.Mode mode()
Constrains the tools available to the model to a pre-defined set.
auto
allows the model to pick from among the allowed tools and generate a message.required
requires the model to call one or more of the allowed tools.
-
tools
final List<ToolChoiceAllowed.Tool> tools()
A list of tool definitions that the model should be allowed to call.
For the Responses API, the list of tool definitions might look like:
[ { "type": "function", "name": "get_weather" }, { "type": "mcp", "server_label": "deepwiki" }, { "type": "image_generation" } ]
-
_type
final JsonValue _type()
Allowed tool configuration type. Always
allowed_tools
.Expected to always return the following:
JsonValue.from("allowed_tools")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
_mode
final JsonField<ToolChoiceAllowed.Mode> _mode()
Returns the raw JSON value of mode.
Unlike mode, this method doesn't throw if the JSON field has an unexpected type.
-
_tools
final JsonField<List<ToolChoiceAllowed.Tool>> _tools()
Returns the raw JSON value of tools.
Unlike tools, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ToolChoiceAllowed.Builder toBuilder()
-
validate
final ToolChoiceAllowed validate()
-
builder
final static ToolChoiceAllowed.Builder builder()
Returns a mutable builder for constructing an instance of ToolChoiceAllowed.
The following fields are required:
.mode() .tools()
-
-
-
-