Record Class ChatOptions
java.lang.Object
java.lang.Record
smile.llm.ChatOptions
- Record Components:
tools- available tools;nullor empty means no tools.toolChoice- tool selection policy;nulldefaults toToolChoice.AUTO.parallelToolCalls- whether multiple tool calls in one turn are allowed.thinkingMode-THINKING_ENABLED,THINKING_DISABLED,THINKING_ADAPTIVE, ornullfor the model's default (templates that support it).reasoningEffort-xhigh,mediumorlowfor templates with a reasoning-effort setting (Qwen3.8);nullfor the template's default.preserveThinking- whether earlier assistant turns keep their reasoning in the prompt (Qwen3.8'spreserve_thinking);nullfor the template's default.
public record ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls, String thinkingMode, String reasoningEffort, Boolean preserveThinking)
extends Record
Per-request chat options for tool calling.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChatOptionsEmpty options (no tools).static final StringThe model decides whether to think.static final StringThe model answers without thinking.static final StringThinking is requested before every answer. -
Constructor Summary
ConstructorsConstructorDescriptionChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls) Options without a thinking-mode preference.ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls, String thinkingMode) Options without reasoning-effort or preserve-thinking preferences.ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls, String thinkingMode, String reasoningEffort, Boolean preserveThinking) Compact canonical constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasTools()Returns whether tools should be injected into the chat template.booleanReturns the value of theparallelToolCallsrecord component.booleanReturns whether the tool-call output parser should run.Returns the value of thepreserveThinkingrecord component.Returns the value of thereasoningEffortrecord component.Returns the value of thethinkingModerecord component.Returns the value of thetoolChoicerecord component.tools()Returns the value of thetoolsrecord component.Tools filtered for template injection (named choice → single function).final StringtoString()Returns a string representation of this record class.withPreserveThinking(Boolean preserve) Returns a copy with another preserve-thinking preference.withReasoningEffort(String effort) Returns a copy with another reasoning effort.withThinkingMode(String mode) Returns a copy with another thinking mode.
-
Field Details
-
THINKING_ENABLED
-
THINKING_DISABLED
-
THINKING_ADAPTIVE
-
NONE
Empty options (no tools).
-
-
Constructor Details
-
ChatOptions
public ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls, String thinkingMode) Options without reasoning-effort or preserve-thinking preferences.- Parameters:
tools- tool definitions; may benull.toolChoice- tool choice;nullmeans auto.parallelToolCalls- whether parallel tool calls are allowed.thinkingMode- thinking mode ornull.
-
ChatOptions
Options without a thinking-mode preference.- Parameters:
tools- tool definitions; may benull.toolChoice- tool choice;nullmeans auto.parallelToolCalls- whether parallel tool calls are allowed.
-
ChatOptions
public ChatOptions(ToolDefinition[] tools, ToolChoice toolChoice, boolean parallelToolCalls, String thinkingMode, String reasoningEffort, Boolean preserveThinking) Compact canonical constructor.
-
-
Method Details
-
withThinkingMode
Returns a copy with another thinking mode.- Parameters:
mode-THINKING_ENABLED,THINKING_DISABLED,THINKING_ADAPTIVEornull.- Returns:
- the new options.
-
withReasoningEffort
Returns a copy with another reasoning effort.- Parameters:
effort-xhigh,medium,lowornullfor the template default.- Returns:
- the new options.
-
withPreserveThinking
Returns a copy with another preserve-thinking preference.- Parameters:
preserve- whether earlier turns keep their reasoning, ornullfor the template default.- Returns:
- the new options.
-
hasTools
public boolean hasTools()Returns whether tools should be injected into the chat template.- Returns:
truewhen tools should be injected into the chat template.
-
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:
truewhen the tool-call output parser should run.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
tools
-
toolChoice
Returns the value of thetoolChoicerecord component.- Returns:
- the value of the
toolChoicerecord component
-
parallelToolCalls
public boolean parallelToolCalls()Returns the value of theparallelToolCallsrecord component.- Returns:
- the value of the
parallelToolCallsrecord component
-
thinkingMode
Returns the value of thethinkingModerecord component.- Returns:
- the value of the
thinkingModerecord component
-
reasoningEffort
Returns the value of thereasoningEffortrecord component.- Returns:
- the value of the
reasoningEffortrecord component
-
preserveThinking
Returns the value of thepreserveThinkingrecord component.- Returns:
- the value of the
preserveThinkingrecord component
-