Class ThinkingConfigParam
-
- All Implemented Interfaces:
public final class ThinkingConfigParamConfiguration for Claude's thinking.
With
{"type": "adaptive"}, Claude decides when and how much to think. With{"type": "enabled"}(manual extended thinking), you set abudget_tokensof at least 1,024. Thinking tokens count toward yourmax_tokenslimit.Which
typevalues are accepted, and what happens when you omitthinking, depend on the model. See thinking for each model's behavior.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceThinkingConfigParam.VisitorAn interface that defines how to map each variant of ThinkingConfigParam to a value of type T.
public final classThinkingConfigParam.Type
-
Method Summary
-
-
Method Detail
-
enabled
final Optional<ThinkingConfigEnabled> enabled()
-
disabled
final Optional<ThinkingConfigDisabled> disabled()
-
betweenTools
final Optional<ThinkingConfigBetweenTools> betweenTools()
-
adaptive
final Optional<ThinkingConfigAdaptive> adaptive()
-
type
final ThinkingConfigParam.Type type()
-
isDisabled
final Boolean isDisabled()
-
isBetweenTools
final Boolean isBetweenTools()
-
isAdaptive
final Boolean isAdaptive()
-
asEnabled
final ThinkingConfigEnabled asEnabled()
-
asDisabled
final ThinkingConfigDisabled asDisabled()
-
asBetweenTools
final ThinkingConfigBetweenTools asBetweenTools()
-
asAdaptive
final ThinkingConfigAdaptive asAdaptive()
-
accept
final <T extends Any> T accept(ThinkingConfigParam.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = thinkingConfigParam.accept(new ThinkingConfigParam.Visitor<Optional<String>>() { @Override public Optional<String> visitEnabled(ThinkingConfigEnabled enabled) { return Optional.of(enabled.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ThinkingConfigParam validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofEnabled
final static ThinkingConfigParam ofEnabled(ThinkingConfigEnabled enabled)
-
ofEnabled
final static ThinkingConfigParam ofEnabled(Long budgetTokens)
Returns an immutable instance of ThinkingConfigParam whose ofEnabled variant is built from the given required budgetTokens.
-
ofDisabled
final static ThinkingConfigParam ofDisabled(ThinkingConfigDisabled disabled)
-
ofBetweenTools
final static ThinkingConfigParam ofBetweenTools(ThinkingConfigBetweenTools betweenTools)
-
ofAdaptive
final static ThinkingConfigParam ofAdaptive(ThinkingConfigAdaptive adaptive)
-
-
-
-