Class AnthropicModelCatalog.Builder

java.lang.Object
dev.langchain4j.model.anthropic.AnthropicModelCatalog.Builder
Enclosing class:
AnthropicModelCatalog

public static class AnthropicModelCatalog.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • httpClientBuilder

      public AnthropicModelCatalog.Builder httpClientBuilder(HttpClientBuilder httpClientBuilder)
      Sets a custom HttpClientBuilder for the underlying HTTP client. Use this to configure timeouts, proxies, or other HTTP-level settings.
      Parameters:
      httpClientBuilder - the HTTP client builder
      Returns:
      this
    • baseUrl

      public AnthropicModelCatalog.Builder baseUrl(String baseUrl)
      Sets the base URL of the Anthropic API.

      Defaults to https://api.anthropic.com/v1/.

      Parameters:
      baseUrl - the base URL
      Returns:
      this
    • apiKey

      public AnthropicModelCatalog.Builder apiKey(String apiKey)
      Sets the Anthropic API key used to authenticate requests.

      Alternatively, set the ANTHROPIC_API_KEY environment variable.

      Parameters:
      apiKey - the API key
      Returns:
      this
    • version

      public AnthropicModelCatalog.Builder version(String version)
      Sets the value of the anthropic-version request header.

      Defaults to 2023-06-01. See the Anthropic API versioning docs.

      Parameters:
      version - the API version string
      Returns:
      this
    • timeout

      public AnthropicModelCatalog.Builder timeout(Duration timeout)
      Sets the HTTP request timeout for calls to the Anthropic API.
      Parameters:
      timeout - the request timeout
      Returns:
      this
    • logRequests

      public AnthropicModelCatalog.Builder logRequests(Boolean logRequests)
      Enables debug logging of HTTP request bodies sent to the Anthropic API.
      Parameters:
      logRequests - whether to log requests
      Returns:
      this
    • logResponses

      public AnthropicModelCatalog.Builder logResponses(Boolean logResponses)
      Enables debug logging of HTTP response bodies received from the Anthropic API.
      Parameters:
      logResponses - whether to log responses
      Returns:
      this
    • logger

      public AnthropicModelCatalog.Builder logger(org.slf4j.Logger logger)
      Sets an alternate Logger to be used instead of the default one provided by LangChain4j for logging requests and responses.
      Parameters:
      logger - the logger to use
      Returns:
      this
    • build

      public AnthropicModelCatalog build()