Record Class ChatOptions

java.lang.Object
java.lang.Record
smile.llm.ChatOptions
Record Components:
tools - available tools; null or empty means no tools.
toolChoice - tool selection policy; null defaults to ToolChoice.AUTO.
parallelToolCalls - whether multiple tool calls in one turn are allowed.

public record ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls) extends Record
Per-request chat options for tool calling.
  • Field Details

    • NONE

      public static final ChatOptions NONE
      Empty options (no tools).
  • Constructor Details

    • ChatOptions

      public ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls)
      Compact canonical constructor.
  • Method Details

    • hasTools

      public boolean hasTools()
      Returns whether tools should be injected into the chat template.
      Returns:
      true when tools should be injected into the chat template.
    • toolsForTemplate

      public List<ToolDefinition> toolsForTemplate()
      Tools filtered for template injection (named choice → single function).
      Returns:
      tools to expose, or empty list when none.
    • parseToolCalls

      public boolean parseToolCalls()
      Returns whether the tool-call output parser should run.
      Returns:
      true when the tool-call output parser should run.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tools

      public ToolDefinition[] tools()
      Returns the value of the tools record component.
      Returns:
      the value of the tools record component
    • toolChoice

      public ToolChoice toolChoice()
      Returns the value of the toolChoice record component.
      Returns:
      the value of the toolChoice record component
    • parallelToolCalls

      public boolean parallelToolCalls()
      Returns the value of the parallelToolCalls record component.
      Returns:
      the value of the parallelToolCalls record component