Package org.springframework.ai.anthropic
Class AnthropicChatOptions
java.lang.Object
org.springframework.ai.anthropic.AnthropicChatOptions
- All Implemented Interfaces:
ChatOptions,ModelOptions,StructuredOutputChatOptions,ToolCallingChatOptions
public class AnthropicChatOptions
extends Object
implements ToolCallingChatOptions, 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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.springframework.ai.model.tool.ToolCallingChatOptions
DEFAULT_TOOL_EXECUTION_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnthropicChatOptions.Builderbuilder()copy()Returns a copy of thisChatOptions.booleanstatic AnthropicChatOptionsfromOptions(AnthropicChatOptions fromOptions) Returns the frequency penalty to use for the chat.Whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.Returns the maximum number of tokens to use for the chat.getModel()Returns the model to use for the chat.Returns the presence penalty to use for the chat.Returns the stop sequences to use for the chat.Returns the temperature to use for the chat.ToolCallbacks to be registered with the ChatModel.Get the configured tool context.Names of the tools to register with the ChatModel.getTopK()Returns the top K to use for the chat.getTopP()Returns the top P to use for the chat.inthashCode()voidsetCacheOptions(AnthropicCacheOptions cacheOptions) voidsetCitationDocuments(List<CitationDocument> citationDocuments) voidsetHttpHeaders(Map<String, String> httpHeaders) voidsetInternalToolExecutionEnabled(Boolean internalToolExecutionEnabled) Set whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.voidsetMaxTokens(Integer maxTokens) voidvoidvoidvoidsetOutputSchema(String outputSchema) voidsetSkillContainer(AnthropicApi.SkillContainer skillContainer) voidsetStopSequences(List<String> stopSequences) voidsetTemperature(Double temperature) voidvoidsetToolCallbacks(List<ToolCallback> toolCallbacks) Set the ToolCallbacks to be registered with the ChatModel.voidsetToolChoice(AnthropicApi.ToolChoice toolChoice) voidsetToolContext(Map<String, Object> toolContext) Set the tool context values as map.voidsetToolNames(Set<String> toolNames) Set the names of the tools to register with the ChatModel.voidvoidvoidValidate that all citation documents have consistent citation settings.
-
Constructor Details
-
AnthropicChatOptions
public AnthropicChatOptions()
-
-
Method Details
-
getCacheOptions
-
setCacheOptions
-
builder
-
fromOptions
-
getSkillContainer
-
setSkillContainer
-
getModel
Description copied from interface:ChatOptionsReturns the model to use for the chat.- Specified by:
getModelin interfaceChatOptions- Returns:
- the model to use for the chat
-
setModel
-
getMaxTokens
Description copied from interface:ChatOptionsReturns the maximum number of tokens to use for the chat.- Specified by:
getMaxTokensin interfaceChatOptions- Returns:
- the maximum number of tokens to use for the chat
-
setMaxTokens
-
getMetadata
-
setMetadata
-
getStopSequences
Description copied from interface:ChatOptionsReturns the stop sequences to use for the chat.- Specified by:
getStopSequencesin interfaceChatOptions- Returns:
- the stop sequences to use for the chat
-
setStopSequences
-
getTemperature
Description copied from interface:ChatOptionsReturns the temperature to use for the chat.- Specified by:
getTemperaturein interfaceChatOptions- Returns:
- the temperature to use for the chat
-
setTemperature
-
getTopP
Description copied from interface:ChatOptionsReturns the top P to use for the chat.- Specified by:
getTopPin interfaceChatOptions- Returns:
- the top P to use for the chat
-
setTopP
-
getTopK
Description copied from interface:ChatOptionsReturns the top K to use for the chat.- Specified by:
getTopKin interfaceChatOptions- Returns:
- the top K to use for the chat
-
setTopK
-
getToolChoice
-
setToolChoice
-
getThinking
-
setThinking
-
getToolCallbacks
Description copied from interface:ToolCallingChatOptionsToolCallbacks to be registered with the ChatModel.- Specified by:
getToolCallbacksin interfaceToolCallingChatOptions
-
setToolCallbacks
Description copied from interface:ToolCallingChatOptionsSet the ToolCallbacks to be registered with the ChatModel.- Specified by:
setToolCallbacksin interfaceToolCallingChatOptions
-
getToolNames
Description copied from interface:ToolCallingChatOptionsNames of the tools to register with the ChatModel.- Specified by:
getToolNamesin interfaceToolCallingChatOptions
-
setToolNames
Description copied from interface:ToolCallingChatOptionsSet the names of the tools to register with the ChatModel.- Specified by:
setToolNamesin interfaceToolCallingChatOptions
-
getInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsWhether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
getInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
setInternalToolExecutionEnabled
Description copied from interface:ToolCallingChatOptionsSet whether theChatModelis responsible for executing the tools requested by the model or if the tools should be executed directly by the caller.- Specified by:
setInternalToolExecutionEnabledin interfaceToolCallingChatOptions
-
getFrequencyPenalty
Description copied from interface:ChatOptionsReturns the frequency penalty to use for the chat.- Specified by:
getFrequencyPenaltyin interfaceChatOptions- Returns:
- the frequency penalty to use for the chat
-
getPresencePenalty
Description copied from interface:ChatOptionsReturns the presence penalty to use for the chat.- Specified by:
getPresencePenaltyin interfaceChatOptions- Returns:
- the presence penalty to use for the chat
-
getToolContext
Description copied from interface:ToolCallingChatOptionsGet the configured tool context.- Specified by:
getToolContextin interfaceToolCallingChatOptions- Returns:
- the tool context map.
-
setToolContext
Description copied from interface:ToolCallingChatOptionsSet the tool context values as map.- Specified by:
setToolContextin interfaceToolCallingChatOptions- Parameters:
toolContext- as map
-
getHttpHeaders
-
setHttpHeaders
-
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. -
getOutputFormat
-
setOutputFormat
-
getOutputSchema
- Specified by:
getOutputSchemain interfaceStructuredOutputChatOptions
-
setOutputSchema
- Specified by:
setOutputSchemain interfaceStructuredOutputChatOptions
-
copy
Description copied from interface:ChatOptionsReturns a copy of thisChatOptions.- Specified by:
copyin interfaceChatOptions- Returns:
- a copy of this
ChatOptions
-
equals
-
hashCode
public int hashCode()
-