Class AnthropicChatOptions.Builder
java.lang.Object
org.springframework.ai.anthropic.AnthropicChatOptions.Builder
- Enclosing class:
AnthropicChatOptions
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Thomas Vitale, Alexandros Pappas, Ilayaperumal Gopinathan, Soby Chacko, Austin Dase
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCitationDocument(CitationDocument document) Add a single citation document.anthropicSkill(AnthropicApi.AnthropicSkill anthropicSkill) Deprecated.anthropicSkill(AnthropicApi.AnthropicSkill anthropicSkill, String version) Deprecated.Useskill(AnthropicApi.AnthropicSkill, String)insteadbuild()cacheOptions(AnthropicCacheOptions cacheOptions) citationDocuments(List<CitationDocument> citationDocuments) Set citation documents for the request.citationDocuments(CitationDocument... documents) Set citation documents from variable arguments.customSkill(String skillId) Deprecated.Useskill(String)insteadcustomSkill(String skillId, String version) Deprecated.Useskill(String, String)insteadhttpHeaders(Map<String, String> httpHeaders) internalToolExecutionEnabled(Boolean internalToolExecutionEnabled) model(AnthropicApi.ChatModel model) outputFormat(AnthropicApi.ChatCompletionRequest.OutputFormat outputFormat) outputSchema(String outputSchema) Add a skill by its ID or name.Add a skill by its ID or name with a specific version.skill(AnthropicApi.AnthropicSkill anthropicSkill) Add a pre-built Anthropic skill using the enum.skill(AnthropicApi.AnthropicSkill anthropicSkill, String version) Add a pre-built Anthropic skill with specific version.skill(AnthropicApi.Skill skill) Add a Skill record directly.skillContainer(AnthropicApi.SkillContainer skillContainer) Set the Skills container for this request.Add multiple skills by their IDs or names.Add multiple skills from a list of IDs or names.stopSequences(List<String> stopSequences) temperature(Double temperature) thinking(AnthropicApi.ThinkingType type, Integer budgetTokens) toolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks) toolCallbacks(org.springframework.ai.tool.ToolCallback... toolCallbacks) toolChoice(AnthropicApi.ToolChoice toolChoice) toolContext(Map<String, Object> toolContext)
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
model
-
model
-
maxTokens
-
metadata
-
stopSequences
-
temperature
-
topP
-
topK
-
toolChoice
-
thinking
public AnthropicChatOptions.Builder thinking(AnthropicApi.ChatCompletionRequest.ThinkingConfig thinking) -
thinking
-
toolCallbacks
public AnthropicChatOptions.Builder toolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks) -
toolCallbacks
public AnthropicChatOptions.Builder toolCallbacks(org.springframework.ai.tool.ToolCallback... toolCallbacks) -
toolNames
-
toolNames
-
internalToolExecutionEnabled
public AnthropicChatOptions.Builder internalToolExecutionEnabled(@Nullable Boolean internalToolExecutionEnabled) -
toolContext
-
httpHeaders
-
cacheOptions
-
citationDocuments
Set citation documents for the request.- Parameters:
citationDocuments- List of documents to include for citations- Returns:
- Builder for method chaining
-
citationDocuments
Set citation documents from variable arguments.- Parameters:
documents- Variable number of CitationDocument objects- Returns:
- Builder for method chaining
-
addCitationDocument
Add a single citation document.- Parameters:
document- Citation document to add- Returns:
- Builder for method chaining
-
outputFormat
public AnthropicChatOptions.Builder outputFormat(AnthropicApi.ChatCompletionRequest.OutputFormat outputFormat) -
outputSchema
-
skillContainer
Set the Skills container for this request.- Parameters:
skillContainer- Container with skills to make available- Returns:
- Builder for method chaining
-
skill
Add a skill by its ID or name. Automatically detects whether it's a pre-built Anthropic skill (xlsx, pptx, docx, pdf) or a custom skill ID.Example:
AnthropicChatOptions options = AnthropicChatOptions.builder() .model("claude-sonnet-4-5") .skill("xlsx") // Pre-built skill .skill("skill_01abc123...") // Custom skill .build();- Parameters:
skillIdOrName- The skill ID or name- Returns:
- Builder for method chaining
-
skill
Add a skill by its ID or name with a specific version.- Parameters:
skillIdOrName- The skill ID or nameversion- The version (e.g., "latest", "20251013")- Returns:
- Builder for method chaining
-
skill
Add a pre-built Anthropic skill using the enum.Example:
AnthropicChatOptions options = AnthropicChatOptions.builder() .model("claude-sonnet-4-5") .skill(AnthropicSkill.XLSX) .skill(AnthropicSkill.PPTX) .build();- Parameters:
anthropicSkill- Pre-built Anthropic skill to add- Returns:
- Builder for method chaining
-
skill
public AnthropicChatOptions.Builder skill(AnthropicApi.AnthropicSkill anthropicSkill, String version) Add a pre-built Anthropic skill with specific version.- Parameters:
anthropicSkill- Pre-built Anthropic skill to addversion- Version of the skill (e.g., "latest", "20251013")- Returns:
- Builder for method chaining
-
skill
Add a Skill record directly.- Parameters:
skill- Skill to add- Returns:
- Builder for method chaining
-
skills
Add multiple skills by their IDs or names.- Parameters:
skillIds- The skill IDs or names- Returns:
- Builder for method chaining
-
skills
Add multiple skills from a list of IDs or names.- Parameters:
skillIds- The list of skill IDs or names- Returns:
- Builder for method chaining
-
anthropicSkill
@Deprecated public AnthropicChatOptions.Builder anthropicSkill(AnthropicApi.AnthropicSkill anthropicSkill) Deprecated.Useskill(AnthropicApi.AnthropicSkill)insteadAdd an Anthropic pre-built skill (xlsx, pptx, docx, pdf).- Parameters:
anthropicSkill- Pre-built Anthropic skill to add- Returns:
- Builder for method chaining
-
anthropicSkill
@Deprecated public AnthropicChatOptions.Builder anthropicSkill(AnthropicApi.AnthropicSkill anthropicSkill, String version) Deprecated.Useskill(AnthropicApi.AnthropicSkill, String)insteadAdd an Anthropic pre-built skill with specific version.- Parameters:
anthropicSkill- Pre-built Anthropic skill to addversion- Version of the skill (e.g., "latest", "20251013")- Returns:
- Builder for method chaining
-
customSkill
Deprecated.Useskill(String)insteadAdd a custom skill by ID.- Parameters:
skillId- Custom skill ID- Returns:
- Builder for method chaining
-
customSkill
Deprecated.Useskill(String, String)insteadAdd a custom skill with specific version.- Parameters:
skillId- Custom skill IDversion- Version of the skill- Returns:
- Builder for method chaining
-
build
-
skill(AnthropicApi.AnthropicSkill)instead