public final class ToolChoice
- Object
- ToolChoice
Controls how aggressively the model will call tools. Use the
constants for the three common modes; use
named(String) to force
the model to call a specific tool.Fields
public static final ToolChoice AUTO | Model picks freely between calling tools and replying with text. |
public static final ToolChoice NONE | Model must not call any tool – it must reply with text. |
public static final ToolChoice REQUIRED | Model must call exactly one tool (any tool). |
Methods
public static ToolChoice named(String toolName) | Forces the model to call the named tool. |
public String getMode() | |
public String getForcedToolName() |
Inherited methods
Field details
AUTO
public static final ToolChoice AUTOModel picks freely between calling tools and replying with text.
NONE
public static final ToolChoice NONEModel must not call any tool – it must reply with text.
REQUIRED
public static final ToolChoice REQUIREDModel must call exactly one tool (any tool). Useful for forcing
a structured-output path.
Method details
named
public static ToolChoice named(String toolName)Forces the model to call the named tool.
getMode
public String getMode()Returns
portable choice mode:
auto, none,
required, or namedgetForcedToolName
public String getForcedToolName()Returns
forced tool name for a named choice, otherwise
null