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
The options to be used when sending a chat request to the Anthropic API.
Since:
1.0.0
Author:
Christian Tzolov, Thomas Vitale, Alexandros Pappas, Ilayaperumal Gopinathan, Soby Chacko, Austin Dase
  • Constructor Details

    • AnthropicChatOptions

      public AnthropicChatOptions()
  • Method Details

    • getCacheOptions

      public AnthropicCacheOptions getCacheOptions()
    • setCacheOptions

      public void setCacheOptions(AnthropicCacheOptions cacheOptions)
    • getSkillContainer

      public AnthropicApi.SkillContainer getSkillContainer()
    • setSkillContainer

      public void setSkillContainer(AnthropicApi.SkillContainer skillContainer)
    • builder

      public static AnthropicChatOptions.Builder builder()
    • fromOptions

      public static AnthropicChatOptions fromOptions(AnthropicChatOptions fromOptions)
    • getModel

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

      public void setModel(String model)
    • getMaxTokens

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

      public void setMaxTokens(Integer maxTokens)
    • getMetadata

    • setMetadata

      public void setMetadata(AnthropicApi.ChatCompletionRequest.Metadata metadata)
    • getStopSequences

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

      public void setStopSequences(List<String> stopSequences)
    • getTemperature

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

      public void setTemperature(Double temperature)
    • getTopP

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

      public void setTopP(Double topP)
    • getTopK

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

      public void setTopK(Integer topK)
    • getToolChoice

      public AnthropicApi.ToolChoice getToolChoice()
    • setToolChoice

      public void setToolChoice(AnthropicApi.ToolChoice toolChoice)
    • getThinking

    • setThinking

      public void setThinking(AnthropicApi.ChatCompletionRequest.ThinkingConfig thinking)
    • getToolCallbacks

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

      public void setToolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks)
      Specified by:
      setToolCallbacks in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getToolNames

      public Set<String> getToolNames()
      Specified by:
      getToolNames in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setToolNames

      public void setToolNames(Set<String> toolNames)
      Specified by:
      setToolNames in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getInternalToolExecutionEnabled

      @Nullable public Boolean getInternalToolExecutionEnabled()
      Specified by:
      getInternalToolExecutionEnabled in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • setInternalToolExecutionEnabled

      public void setInternalToolExecutionEnabled(@Nullable Boolean internalToolExecutionEnabled)
      Specified by:
      setInternalToolExecutionEnabled in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getFrequencyPenalty

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

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

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

      public void setToolContext(Map<String,Object> toolContext)
      Specified by:
      setToolContext in interface org.springframework.ai.model.tool.ToolCallingChatOptions
    • getHttpHeaders

      public Map<String,String> getHttpHeaders()
    • setHttpHeaders

      public void setHttpHeaders(Map<String,String> httpHeaders)
    • getCitationDocuments

      public List<CitationDocument> getCitationDocuments()
    • setCitationDocuments

      public void setCitationDocuments(List<CitationDocument> citationDocuments)
    • validateCitationConsistency

      public void validateCitationConsistency()
      Validate that all citation documents have consistent citation settings. Anthropic requires all documents to have citations enabled if any do.
    • getOutputFormat

    • setOutputFormat

      public void setOutputFormat(AnthropicApi.ChatCompletionRequest.OutputFormat outputFormat)
    • getOutputSchema

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

      public void setOutputSchema(String outputSchema)
      Specified by:
      setOutputSchema in interface org.springframework.ai.model.tool.StructuredOutputChatOptions
    • copy

      public AnthropicChatOptions copy()
      Specified by:
      copy in interface org.springframework.ai.chat.prompt.ChatOptions
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object