Class ToolChoice

java.lang.Object
com.codename1.ai.ToolChoice

public final class ToolChoice extends java.lang.Object
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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ToolChoice
    Model picks freely between calling tools and replying with text.
    static final ToolChoice
    Model must not call any tool -- it must reply with text.
    static final ToolChoice
    Model must call exactly one tool (any tool).
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    static ToolChoice
    named(String toolName)
    Forces the model to call the named tool.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • AUTO

      public static final ToolChoice AUTO
      Model picks freely between calling tools and replying with text.
    • NONE

      public static final ToolChoice NONE
      Model must not call any tool -- it must reply with text.
    • REQUIRED

      public static final ToolChoice REQUIRED
      Model 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()
    • getForcedToolName

      public String getForcedToolName()