Class WatsonxGatewayModelCatalog.Builder

java.lang.Object
dev.langchain4j.model.watsonx.WatsonxGatewayModelCatalog.Builder
Enclosing class:
WatsonxGatewayModelCatalog

public static class WatsonxGatewayModelCatalog.Builder extends Object
Builder class for constructing WatsonxGatewayModelCatalog instances with configurable parameters.
  • Field Details

    • baseUrl

      protected URI baseUrl
    • version

      protected String version
    • apiKey

      protected String apiKey
    • logRequests

      protected Boolean logRequests
    • logResponses

      protected Boolean logResponses
    • timeout

      protected Duration timeout
    • authenticator

      protected com.ibm.watsonx.ai.core.auth.Authenticator authenticator
    • httpClient

      protected HttpClient httpClient
    • verifySsl

      protected boolean verifySsl
  • Method Details

    • build

    • baseUrl

      public WatsonxGatewayModelCatalog.Builder baseUrl(com.ibm.watsonx.ai.CloudRegion baseUrl)
      Sets the IBM watsonx.ai endpoint from a predefined CloudRegion.
      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 a URI.
      Parameters:
      url - the base URL URI
      Returns:
      this
    • version

      public WatsonxGatewayModelCatalog.Builder version(String version)
      Sets the watsonx.ai API version date, e.g. "2024-05-31".
      Parameters:
      version - the API version date string
      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

      public WatsonxGatewayModelCatalog.Builder logRequests(Boolean logRequests)
      Enables debug logging of request bodies sent to the watsonx.ai API.
      Parameters:
      logRequests - true to enable request logging
      Returns:
      this
    • logResponses

      public WatsonxGatewayModelCatalog.Builder logResponses(Boolean logResponses)
      Enables debug logging of response bodies received from the watsonx.ai API.
      Parameters:
      logResponses - true to enable response logging
      Returns:
      this
    • timeout

      public WatsonxGatewayModelCatalog.Builder timeout(Duration timeout)
      Sets the HTTP request timeout. Defaults to 60 seconds.
      Parameters:
      timeout - the request timeout
      Returns:
      this
    • authenticator

      public WatsonxGatewayModelCatalog.Builder authenticator(com.ibm.watsonx.ai.core.auth.Authenticator authenticator)
      Sets a custom Authenticator for generating bearer tokens.
      Parameters:
      authenticator - the authenticator
      Returns:
      this
    • httpClient

      public WatsonxGatewayModelCatalog.Builder httpClient(HttpClient httpClient)
      Sets a custom HttpClient to use for all API calls.
      Parameters:
      httpClient - the HTTP client
      Returns:
      this
    • verifySsl

      public WatsonxGatewayModelCatalog.Builder verifySsl(boolean verifySsl)
      Controls whether SSL certificate verification is performed. Defaults to true.
      Parameters:
      verifySsl - false to disable SSL verification
      Returns:
      this