Class WatsonxEmbeddingModel.Builder
java.lang.Object
dev.langchain4j.model.watsonx.WatsonxEmbeddingModel.Builder
- Enclosing class:
WatsonxEmbeddingModel
Builder class for constructing
WatsonxEmbeddingModel instances with configurable parameters.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionSets the IBM Cloud API key used to generate IAM access tokens for authentication.authenticator(com.ibm.watsonx.ai.core.auth.Authenticator authenticator) Sets a customAuthenticatorfor generating bearer tokens.baseUrl(com.ibm.watsonx.ai.CloudRegion baseUrl) Sets the IBM watsonx.ai endpoint from a predefinedCloudRegion.Sets the base URL of the IBM watsonx.ai API.Sets the base URL of the IBM watsonx.ai API as aURI.build()httpClient(HttpClient httpClient) Sets a customHttpClientto use for all API calls.logRequests(Boolean logRequests) Enables debug logging of request bodies sent to the watsonx.ai API.logResponses(Boolean logResponses) Enables debug logging of response bodies received from the watsonx.ai API.Sets the watsonx.ai embedding model ID, e.g.Sets the IBM Cloud project ID that owns the watsonx.ai resources.Sets the IBM Cloud deployment space ID.Sets the HTTP request timeout.verifySsl(boolean verifySsl) Controls whether SSL certificate verification is performed.Sets the watsonx.ai API version date, e.g.
-
Field Details
-
baseUrl
-
version
-
apiKey
-
projectId
-
spaceId
-
logRequests
-
logResponses
-
timeout
-
authenticator
protected com.ibm.watsonx.ai.core.auth.Authenticator authenticator -
httpClient
-
verifySsl
protected boolean verifySsl
-
-
Method Details
-
modelName
Sets the watsonx.ai embedding model ID, e.g."ibm/slate-125m-english-rtrvr".- Parameters:
modelName- the model ID- Returns:
this
-
build
-
baseUrl
Sets the IBM watsonx.ai endpoint from a predefinedCloudRegion.- Parameters:
baseUrl- the IBM Cloud region whose ML endpoint will be used- Returns:
this
-
baseUrl
Sets the base URL of the IBM watsonx.ai API.- Parameters:
url- the base URL string, e.g."https://us-south.ml.cloud.ibm.com"- Returns:
this
-
baseUrl
Sets the base URL of the IBM watsonx.ai API as aURI.- Parameters:
url- the base URL URI- Returns:
this
-
version
Sets the watsonx.ai API version date, e.g."2024-05-31".- Parameters:
version- the API version date string- Returns:
this
-
projectId
Sets the IBM Cloud project ID that owns the watsonx.ai resources. Exactly one ofprojectIdorspaceIdmust be set.- Parameters:
projectId- the IBM Cloud project ID- Returns:
this
-
spaceId
Sets the IBM Cloud deployment space ID. Exactly one ofprojectIdorspaceIdmust be set.- Parameters:
spaceId- the IBM Cloud deployment space ID- Returns:
this
-
apiKey
Sets the IBM Cloud API key used to generate IAM access tokens for authentication.- Parameters:
apiKey- the IBM Cloud API key- Returns:
this
-
logRequests
Enables debug logging of request bodies sent to the watsonx.ai API.- Parameters:
logRequests-trueto enable request logging- Returns:
this
-
logResponses
Enables debug logging of response bodies received from the watsonx.ai API.- Parameters:
logResponses-trueto enable response logging- Returns:
this
-
timeout
Sets the HTTP request timeout. Defaults to 60 seconds.- Parameters:
timeout- the request timeout- Returns:
this
-
authenticator
public WatsonxEmbeddingModel.Builder authenticator(com.ibm.watsonx.ai.core.auth.Authenticator authenticator) Sets a customAuthenticatorfor generating bearer tokens. Use this instead ofapiKeywhen you need a non-standard authentication flow.- Parameters:
authenticator- the authenticator- Returns:
this
-
httpClient
Sets a customHttpClientto use for all API calls.- Parameters:
httpClient- the HTTP client- Returns:
this
-
verifySsl
Controls whether SSL certificate verification is performed. Defaults totrue. Set tofalseonly in non-production environments.- Parameters:
verifySsl-falseto disable SSL verification- Returns:
this
-