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:
  • Field Details

    • DEFAULT_MODEL

      public static final String DEFAULT_MODEL
      Default model to use for chat completions.
    • DEFAULT_MAX_TOKENS

      public static final Integer DEFAULT_MAX_TOKENS
      Default max tokens for chat completions.
  • Constructor Details

  • Method Details

    • builder

      public static AnthropicChatOptions.Builder builder()
      Creates a new builder for AnthropicChatOptions.
      Returns:
      a new builder instance
    • getBaseUrl

      public @Nullable String getBaseUrl()
    • getApiKey

      public @Nullable String getApiKey()
    • getModel

      public String getModel()
      Specified by:
      getModel in interface org.springframework.ai.chat.prompt.ChatOptions
    • getTimeout

      public @Nullable Duration getTimeout()
    • getMaxRetries

      public @Nullable Integer getMaxRetries()
    • getProxy

      public @Nullable Proxy getProxy()
    • getCustomHeaders

      public @Nullable Map<String,String> getCustomHeaders()
    • getMaxTokens

      public Integer getMaxTokens()
      Specified by:
      getMaxTokens in interface org.springframework.ai.chat.prompt.ChatOptions
    • getMetadata

      public @Nullable com.anthropic.models.messages.Metadata getMetadata()
    • getStopSequences

      public @Nullable List<String> getStopSequences()
      Specified by:
      getStopSequences in interface org.springframework.ai.chat.prompt.ChatOptions
    • getTemperature

      public @Nullable Double getTemperature()
      Specified by:
      getTemperature in interface org.springframework.ai.chat.prompt.ChatOptions
    • getTopP

      public @Nullable Double getTopP()
      Specified by:
      getTopP in interface org.springframework.ai.chat.prompt.ChatOptions
    • getTopK

      public @Nullable Integer getTopK()
      Specified by:
      getTopK in interface org.springframework.ai.chat.prompt.ChatOptions
    • getToolChoice

      public @Nullable com.anthropic.models.messages.ToolChoice getToolChoice()
    • getThinking

      public @Nullable com.anthropic.models.messages.ThinkingConfigParam getThinking()
    • getDisableParallelToolUse

      public @Nullable Boolean getDisableParallelToolUse()
    • getToolCallbacks

      public @Nullable List<org.springframework.ai.tool.ToolCallback> getToolCallbacks()
      Specified by:
      getToolCallbacks in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getToolContext

      public @Nullable Map<String,Object> getToolContext()
      Specified by:
      getToolContext in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getCitationDocuments

      public @Nullable List<AnthropicCitationDocument> 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

      public AnthropicCacheOptions getCacheOptions()
    • getOutputConfig

      public @Nullable com.anthropic.models.messages.OutputConfig getOutputConfig()
    • getHttpHeaders

      public @Nullable Map<String,String> getHttpHeaders()
    • getSkillContainer

      public @Nullable AnthropicSkillContainer getSkillContainer()
    • getInferenceGeo

      public @Nullable String getInferenceGeo()
    • getWebSearchTool

      public @Nullable AnthropicWebSearchTool getWebSearchTool()
    • getServiceTier

      public @Nullable AnthropicServiceTier getServiceTier()
    • getOutputSchema

      public @Nullable String getOutputSchema()
      Specified by:
      getOutputSchema in interface org.springframework.ai.model.tool.StructuredOutputChatOptions
    • getFrequencyPenalty

      public @Nullable Double getFrequencyPenalty()
      Specified by:
      getFrequencyPenalty in interface org.springframework.ai.chat.prompt.ChatOptions
    • getPresencePenalty

      public @Nullable Double getPresencePenalty()
      Specified by:
      getPresencePenalty in interface org.springframework.ai.chat.prompt.ChatOptions
    • mutate

      Specified by:
      mutate in interface org.springframework.ai.chat.prompt.ChatOptions
      Specified by:
      mutate in interface org.springframework.ai.model.tool.StructuredOutputChatOptions
      Specified by:
      mutate in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object