Package dev.langchain4j.model.anthropic
Class AnthropicChatModel.AnthropicChatModelBuilder
java.lang.Object
dev.langchain4j.model.anthropic.AnthropicChatModel.AnthropicChatModelBuilder
- Enclosing class:
AnthropicChatModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
cacheSystemMessages
(Boolean cacheSystemMessages) cacheTools
(Boolean cacheTools) defaultRequestParameters
(ChatRequestParameters parameters) httpClientBuilder
(HttpClientBuilder httpClientBuilder) listeners
(List<ChatModelListener> listeners) logger
(org.slf4j.Logger logger) logRequests
(Boolean logRequests) logResponses
(Boolean logResponses) maxRetries
(Integer maxRetries) modelName
(AnthropicChatModelName modelName) returnThinking
(Boolean returnThinking) Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
.sendThinking
(Boolean sendThinking) Controls whether to send thinking/reasoning text to the LLM in follow-up requests.stopSequences
(List<String> stopSequences) temperature
(Double temperature) thinkingBudgetTokens
(Integer thinkingBudgetTokens) Configures thinking.thinkingType
(String thinkingType) Enables thinking.toolChoice
(ToolChoice toolChoice) toolSpecifications
(ToolSpecification... toolSpecifications) toolSpecifications
(List<ToolSpecification> toolSpecifications)
-
Constructor Details
-
AnthropicChatModelBuilder
public AnthropicChatModelBuilder()
-
-
Method Details
-
httpClientBuilder
public AnthropicChatModel.AnthropicChatModelBuilder httpClientBuilder(HttpClientBuilder httpClientBuilder) -
baseUrl
-
apiKey
-
version
-
beta
-
modelName
-
modelName
-
temperature
-
topP
-
topK
-
maxTokens
-
stopSequences
-
toolSpecifications
public AnthropicChatModel.AnthropicChatModelBuilder toolSpecifications(List<ToolSpecification> toolSpecifications) -
toolSpecifications
public AnthropicChatModel.AnthropicChatModelBuilder toolSpecifications(ToolSpecification... toolSpecifications) -
toolChoice
-
cacheSystemMessages
public AnthropicChatModel.AnthropicChatModelBuilder cacheSystemMessages(Boolean cacheSystemMessages) -
cacheTools
-
thinkingType
Enables thinking. -
thinkingBudgetTokens
public AnthropicChatModel.AnthropicChatModelBuilder thinkingBudgetTokens(Integer thinkingBudgetTokens) Configures thinking. -
returnThinking
Controls whether to return thinking/reasoning text (if available) insideAiMessage.thinking()
. Please note that this does not enable thinking/reasoning for the LLM; it only controls whether to parse thethinking
field from the API response and return it inside theAiMessage
.Disabled by default. If enabled, the thinking text will be stored within the
AiMessage
and may be persisted. If enabled, thinking signatures will also be stored and returned inside theAiMessage.attributes()
.- See Also:
-
sendThinking
Controls whether to send thinking/reasoning text to the LLM in follow-up requests.Enabled by default. If enabled, the contents of
AiMessage.thinking()
will be sent in the API request. If enabled, thinking signatures (inside theAiMessage.attributes()
) will also be sent.- See Also:
-
timeout
-
maxRetries
-
logRequests
-
logResponses
-
logger
- Parameters:
logger
- an alternateLogger
to be used instead of the default one provided by Langchain4J for logging requests and responses.- Returns:
this
.
-
listeners
-
defaultRequestParameters
public AnthropicChatModel.AnthropicChatModelBuilder defaultRequestParameters(ChatRequestParameters parameters) -
build
-