Class AnthropicChatOptions
java.lang.Object
org.springframework.ai.anthropic.AbstractAnthropicOptions
org.springframework.ai.anthropic.AnthropicChatOptions
- All Implemented Interfaces:
org.springframework.ai.chat.prompt.ChatOptions, org.springframework.ai.model.ModelOptions, org.springframework.ai.model.tool.StructuredOutputChatOptions, org.springframework.ai.model.tool.ToolCallingChatOptions
public class AnthropicChatOptions
extends AbstractAnthropicOptions
implements org.springframework.ai.model.tool.ToolCallingChatOptions, org.springframework.ai.model.tool.StructuredOutputChatOptions
Chat options for
AnthropicChatModel. Supports model selection, sampling
parameters (temperature, topP, topK), output control (maxTokens, stopSequences), and
tool calling configuration.
Options can be set as defaults during model construction or overridden per-request via
the Prompt.
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Thomas Vitale, Alexandros Pappas, Ilayaperumal Gopinathan, Soby Chacko, Austin Dase
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classBuilder for creatingAnthropicChatOptionsinstances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IntegerDefault max tokens for chat completions.static final StringDefault model to use for chat completions.Fields inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions
DEFAULT_TOOL_EXECUTION_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnthropicChatOptions.Builderbuilder()Creates a new builder for AnthropicChatOptions.copy()boolean@Nullable Boolean@Nullable Double@Nullable Boolean@Nullable Integer@Nullable com.anthropic.models.messages.Metadata@Nullable com.anthropic.models.messages.OutputConfig@Nullable String@Nullable Double@Nullable AnthropicSkillContainer@Nullable Double@Nullable com.anthropic.models.messages.ThinkingConfigParamList<org.springframework.ai.tool.ToolCallback> @Nullable com.anthropic.models.messages.ToolChoice@Nullable IntegergetTopK()@Nullable DoublegetTopP()inthashCode()mutate()voidsetCacheOptions(AnthropicCacheOptions cacheOptions) voidsetCitationDocuments(List<AnthropicCitationDocument> citationDocuments) voidsetDisableParallelToolUse(@Nullable Boolean disableParallelToolUse) voidsetHttpHeaders(Map<String, String> httpHeaders) voidsetInternalToolExecutionEnabled(@Nullable Boolean internalToolExecutionEnabled) voidsetMaxTokens(@Nullable Integer maxTokens) voidsetMetadata(@Nullable com.anthropic.models.messages.Metadata metadata) voidsetOutputConfig(@Nullable com.anthropic.models.messages.OutputConfig outputConfig) voidsetOutputSchema(@Nullable String outputSchema) voidsetSkillContainer(@Nullable AnthropicSkillContainer skillContainer) voidsetStopSequences(@Nullable List<String> stopSequences) voidsetTemperature(@Nullable Double temperature) voidsetThinking(@Nullable com.anthropic.models.messages.ThinkingConfigParam thinking) voidsetToolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks) voidsetToolChoice(@Nullable com.anthropic.models.messages.ToolChoice toolChoice) voidsetToolContext(Map<String, Object> toolContext) voidsetToolNames(Set<String> toolNames) voidvoidtoString()voidValidate that all citation documents have consistent citation settings.Methods inherited from class AbstractAnthropicOptions
getApiKey, getBaseUrl, getCustomHeaders, getMaxRetries, getModel, getProxy, getTimeout, setApiKey, setBaseUrl, setCustomHeaders, setMaxRetries, setModel, setProxy, setTimeoutMethods inherited from interface org.springframework.ai.chat.prompt.ChatOptions
getModel
-
Field Details
-
DEFAULT_MODEL
Default model to use for chat completions. -
DEFAULT_MAX_TOKENS
Default max tokens for chat completions.
-
-
Constructor Details
-
AnthropicChatOptions
public AnthropicChatOptions()
-
-
Method Details
-
builder
Creates a new builder for AnthropicChatOptions.- Returns:
- a new builder instance
-
getMaxTokens
- Specified by:
getMaxTokensin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
setMaxTokens
-
getMetadata
public @Nullable com.anthropic.models.messages.Metadata getMetadata() -
setMetadata
public void setMetadata(@Nullable com.anthropic.models.messages.Metadata metadata) -
getStopSequences
-
setStopSequences
-
getTemperature
- Specified by:
getTemperaturein interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
setTemperature
-
getTopP
- Specified by:
getTopPin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
setTopP
-
getTopK
- Specified by:
getTopKin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
setTopK
-
getToolChoice
public @Nullable com.anthropic.models.messages.ToolChoice getToolChoice() -
setToolChoice
public void setToolChoice(@Nullable com.anthropic.models.messages.ToolChoice toolChoice) -
getThinking
public @Nullable com.anthropic.models.messages.ThinkingConfigParam getThinking() -
setThinking
public void setThinking(@Nullable com.anthropic.models.messages.ThinkingConfigParam thinking) -
getDisableParallelToolUse
-
setDisableParallelToolUse
-
getToolCallbacks
- Specified by:
getToolCallbacksin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
setToolCallbacks
- Specified by:
setToolCallbacksin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
getToolNames
-
setToolNames
-
getInternalToolExecutionEnabled
- Specified by:
getInternalToolExecutionEnabledin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
setInternalToolExecutionEnabled
- Specified by:
setInternalToolExecutionEnabledin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
getToolContext
-
setToolContext
-
getCitationDocuments
-
setCitationDocuments
-
validateCitationConsistency
public void validateCitationConsistency()Validate that all citation documents have consistent citation settings. Anthropic requires all documents to have citations enabled if any do. -
getCacheOptions
-
setCacheOptions
-
getOutputConfig
public @Nullable com.anthropic.models.messages.OutputConfig getOutputConfig() -
setOutputConfig
public void setOutputConfig(@Nullable com.anthropic.models.messages.OutputConfig outputConfig) -
getHttpHeaders
-
setHttpHeaders
-
getSkillContainer
-
setSkillContainer
-
getOutputSchema
- Specified by:
getOutputSchemain interfaceorg.springframework.ai.model.tool.StructuredOutputChatOptions
-
setOutputSchema
- Specified by:
setOutputSchemain interfaceorg.springframework.ai.model.tool.StructuredOutputChatOptions
-
getFrequencyPenalty
- Specified by:
getFrequencyPenaltyin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getPresencePenalty
- Specified by:
getPresencePenaltyin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
copy
- Specified by:
copyin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
mutate
- Specified by:
mutatein interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
equals
-
hashCode
-
toString
-