Package org.springframework.ai.anthropic
Class AnthropicChatOptions
java.lang.Object
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 Object
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, Sebastien Deleuze
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classBuilder for creatingAnthropicChatOptionsinstances. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAnthropicChatOptions(@Nullable String baseUrl, @Nullable String apiKey, @Nullable String model, @Nullable Duration timeout, @Nullable Integer maxRetries, @Nullable Proxy proxy, @Nullable Map<String, String> customHeaders, @Nullable Integer maxTokens, @Nullable com.anthropic.models.messages.Metadata metadata, @Nullable List<String> stopSequences, @Nullable Double temperature, @Nullable Double topP, @Nullable Integer topK, @Nullable com.anthropic.models.messages.ToolChoice toolChoice, @Nullable com.anthropic.models.messages.ThinkingConfigParam thinking, @Nullable Boolean disableParallelToolUse, @Nullable List<org.springframework.ai.tool.ToolCallback> toolCallbacks, @Nullable Map<String, Object> toolContext, @Nullable List<AnthropicCitationDocument> citationDocuments, @Nullable AnthropicCacheOptions cacheOptions, @Nullable com.anthropic.models.messages.OutputConfig outputConfig, @Nullable Map<String, String> httpHeaders, @Nullable AnthropicSkillContainer skillContainer, @Nullable String inferenceGeo, @Nullable AnthropicWebSearchTool webSearchTool, @Nullable AnthropicServiceTier serviceTier) -
Method Summary
Modifier and TypeMethodDescriptionstatic AnthropicChatOptions.Builderbuilder()Creates a new builder for AnthropicChatOptions.boolean@Nullable String@Nullable String@Nullable List<AnthropicCitationDocument>@Nullable Boolean@Nullable Double@Nullable String@Nullable Integer@Nullable com.anthropic.models.messages.MetadatagetModel()@Nullable com.anthropic.models.messages.OutputConfig@Nullable String@Nullable Double@Nullable ProxygetProxy()@Nullable AnthropicServiceTier@Nullable AnthropicSkillContainer@Nullable Double@Nullable com.anthropic.models.messages.ThinkingConfigParam@Nullable Duration@Nullable List<org.springframework.ai.tool.ToolCallback>@Nullable com.anthropic.models.messages.ToolChoice@Nullable IntegergetTopK()@Nullable DoublegetTopP()@Nullable AnthropicWebSearchToolinthashCode()mutate()voidValidate that all citation documents have consistent citation settings.
-
Field Details
-
DEFAULT_MODEL
Default model to use for chat completions. -
DEFAULT_MAX_TOKENS
Default max tokens for chat completions.
-
-
Constructor Details
-
AnthropicChatOptions
protected AnthropicChatOptions(@Nullable String baseUrl, @Nullable String apiKey, @Nullable String model, @Nullable Duration timeout, @Nullable Integer maxRetries, @Nullable Proxy proxy, @Nullable Map<String, String> customHeaders, @Nullable Integer maxTokens, @Nullable com.anthropic.models.messages.Metadata metadata, @Nullable List<String> stopSequences, @Nullable Double temperature, @Nullable Double topP, @Nullable Integer topK, @Nullable com.anthropic.models.messages.ToolChoice toolChoice, @Nullable com.anthropic.models.messages.ThinkingConfigParam thinking, @Nullable Boolean disableParallelToolUse, @Nullable List<org.springframework.ai.tool.ToolCallback> toolCallbacks, @Nullable Map<String, Object> toolContext, @Nullable List<AnthropicCitationDocument> citationDocuments, @Nullable AnthropicCacheOptions cacheOptions, @Nullable com.anthropic.models.messages.OutputConfig outputConfig, @Nullable Map<String, String> httpHeaders, @Nullable AnthropicSkillContainer skillContainer, @Nullable String inferenceGeo, @Nullable AnthropicWebSearchTool webSearchTool, @Nullable AnthropicServiceTier serviceTier)
-
-
Method Details
-
builder
Creates a new builder for AnthropicChatOptions.- Returns:
- a new builder instance
-
getBaseUrl
-
getApiKey
-
getModel
- Specified by:
getModelin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getTimeout
-
getMaxRetries
-
getProxy
-
getCustomHeaders
-
getMaxTokens
- Specified by:
getMaxTokensin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getMetadata
public @Nullable com.anthropic.models.messages.Metadata getMetadata() -
getStopSequences
- Specified by:
getStopSequencesin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getTemperature
- Specified by:
getTemperaturein interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getTopP
- Specified by:
getTopPin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getTopK
- Specified by:
getTopKin interfaceorg.springframework.ai.chat.prompt.ChatOptions
-
getToolChoice
public @Nullable com.anthropic.models.messages.ToolChoice getToolChoice() -
getThinking
public @Nullable com.anthropic.models.messages.ThinkingConfigParam getThinking() -
getDisableParallelToolUse
-
getToolCallbacks
- Specified by:
getToolCallbacksin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
getToolContext
- Specified by:
getToolContextin interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
getCitationDocuments
-
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
-
getOutputConfig
public @Nullable com.anthropic.models.messages.OutputConfig getOutputConfig() -
getHttpHeaders
-
getSkillContainer
-
getInferenceGeo
-
getWebSearchTool
-
getServiceTier
-
getOutputSchema
- Specified by:
getOutputSchemain 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
-
mutate
- Specified by:
mutatein interfaceorg.springframework.ai.chat.prompt.ChatOptions- Specified by:
mutatein interfaceorg.springframework.ai.model.tool.StructuredOutputChatOptions- Specified by:
mutatein interfaceorg.springframework.ai.model.tool.ToolCallingChatOptions
-
equals
-
hashCode
public int hashCode()
-