Package dev.langchain4j.model.watsonx
Class WatsonxChatModel.Builder
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxChatModel.Builder
- Enclosing class:
WatsonxChatModel
Builder class for constructing
WatsonxChatModel
instances with configurable parameters.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticationProvider
(com.ibm.watsonx.ai.core.auth.AuthenticationProvider authenticationProvider) build()
defaultRequestParameters
(ChatRequestParameters defaultRequestParameters) frequencyPenalty
(Double frequencyPenalty) listeners
(List<ChatModelListener> listeners) logRequests
(Boolean logRequests) logResponses
(Boolean logResponses) maxOutputTokens
(Integer maxOutputTokens) presencePenalty
(Double presencePenalty) responseFormat
(ResponseFormat responseFormat) stopSequences
(String... stopSequences) stopSequences
(List<String> stopSequences) supportedCapabilities
(Capability... supportedCapabilities) supportedCapabilities
(Set<Capability> supportedCapabilities) temperature
(Double temperature) thinking
(com.ibm.watsonx.ai.chat.model.ExtractionTags tags) Sets the tag names used to extract segmented content from the assistant's response.toolChoice
(ToolChoice toolChoice) toolChoiceName
(String toolChoiceName) toolSpecifications
(ToolSpecification... toolSpecifications) toolSpecifications
(List<ToolSpecification> toolSpecifications) topLogprobs
(Integer topLogprobs) url
(com.ibm.watsonx.ai.CloudRegion cloudRegion)
-
Field Details
-
url
-
version
-
apiKey
-
logRequests
-
logResponses
-
authenticationProvider
protected com.ibm.watsonx.ai.core.auth.AuthenticationProvider authenticationProvider
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
-
url
-
modelName
-
projectId
-
spaceId
-
temperature
-
topP
-
frequencyPenalty
-
presencePenalty
-
maxOutputTokens
-
stopSequences
-
stopSequences
-
toolChoice
-
responseFormat
-
logitBias
-
logprobs
-
topLogprobs
-
seed
-
toolChoiceName
-
timeLimit
-
supportedCapabilities
-
supportedCapabilities
-
toolSpecifications
-
toolSpecifications
-
listeners
-
defaultRequestParameters
public WatsonxChatModel.Builder defaultRequestParameters(ChatRequestParameters defaultRequestParameters) -
thinking
Sets the tag names used to extract segmented content from the assistant's response.The provided
ExtractionTags
define which XML-like tags (such as<think>
and<response>
) will be used to extract the response from theAiMessage
.If the
response
tag is not specified inExtractionTags
, it will automatically default to"root"
, meaning that only the text nodes directly under the root element will be treated as the final response.Example:
// Explicitly set both tags builder.thinking(ExtractionTags.of("think", "response")).build(); // Only set reasoning tag — response defaults to "root" builder.thinking(ExtractionTags.of("think")).build();
- Parameters:
tags
- anExtractionTags
instance containing the reasoning and (optionally) response tag names
-
url
-
url
-
version
-
apiKey
-
logRequests
-
logResponses
-
authenticationProvider
public WatsonxChatModel.Builder authenticationProvider(com.ibm.watsonx.ai.core.auth.AuthenticationProvider authenticationProvider)
-