Class AnthropicChatModel.Builder
java.lang.Object
org.springframework.ai.anthropic.AnthropicChatModel.Builder
- Enclosing class:
AnthropicChatModel
Builder for creating
AnthropicChatModel instances.- Since:
- 1.0.0
- Author:
- Christian Tzolov, luocongqiu, Mariusz Bernacki, Thomas Vitale, Claudio Silva Junior, Alexandros Pappas, Jonghoon Park, Soby Chacko, Austin Dase
-
Method Summary
Modifier and TypeMethodDescriptionanthropicClient(com.anthropic.client.AnthropicClient anthropicClient) Sets the synchronous Anthropic client.anthropicClientAsync(com.anthropic.client.AnthropicClientAsync anthropicClientAsync) Sets the asynchronous Anthropic client.build()Builds a newAnthropicChatModelinstance.observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Sets the observation registry for metrics and tracing.options(AnthropicChatOptions options) Sets the chat options.toolCallingManager(org.springframework.ai.model.tool.ToolCallingManager toolCallingManager) Sets the tool calling manager.toolExecutionEligibilityPredicate(org.springframework.ai.model.tool.ToolExecutionEligibilityPredicate toolExecutionEligibilityPredicate) Sets the predicate to determine tool execution eligibility.
-
Method Details
-
anthropicClient
public AnthropicChatModel.Builder anthropicClient(com.anthropic.client.AnthropicClient anthropicClient) Sets the synchronous Anthropic client.- Parameters:
anthropicClient- the synchronous client- Returns:
- this builder
-
anthropicClientAsync
public AnthropicChatModel.Builder anthropicClientAsync(com.anthropic.client.AnthropicClientAsync anthropicClientAsync) Sets the asynchronous Anthropic client.- Parameters:
anthropicClientAsync- the asynchronous client- Returns:
- this builder
-
options
Sets the chat options.- Parameters:
options- the chat options- Returns:
- this builder
-
toolCallingManager
public AnthropicChatModel.Builder toolCallingManager(org.springframework.ai.model.tool.ToolCallingManager toolCallingManager) Sets the tool calling manager.- Parameters:
toolCallingManager- the tool calling manager- Returns:
- this builder
-
observationRegistry
public AnthropicChatModel.Builder observationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Sets the observation registry for metrics and tracing.- Parameters:
observationRegistry- the observation registry- Returns:
- this builder
-
toolExecutionEligibilityPredicate
public AnthropicChatModel.Builder toolExecutionEligibilityPredicate(org.springframework.ai.model.tool.ToolExecutionEligibilityPredicate toolExecutionEligibilityPredicate) Sets the predicate to determine tool execution eligibility.- Parameters:
toolExecutionEligibilityPredicate- the predicate- Returns:
- this builder
-
build
Builds a newAnthropicChatModelinstance.- Returns:
- the configured chat model
-