Class DashScopeHttpClient.Builder

java.lang.Object
io.agentscope.extensions.model.dashscope.DashScopeHttpClient.Builder
Enclosing class:
DashScopeHttpClient

public static class DashScopeHttpClient.Builder extends Object
Builder for DashScopeHttpClient.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • transport

      public DashScopeHttpClient.Builder transport(io.agentscope.core.model.transport.HttpTransport transport)
      Set the HTTP transport.
      Parameters:
      transport - the transport to use
      Returns:
      this builder
    • apiKey

      public DashScopeHttpClient.Builder apiKey(String apiKey)
      Set the API key.
      Parameters:
      apiKey - the DashScope API key
      Returns:
      this builder
    • baseUrl

      public DashScopeHttpClient.Builder baseUrl(String baseUrl)
      Set the base URL.
      Parameters:
      baseUrl - the base URL (null for default)
      Returns:
      this builder
    • publicKeyId

      public DashScopeHttpClient.Builder publicKeyId(String publicKeyId)
      Set the RSA public key ID for encryption.

      When both publicKeyId and publicKey are set, requests and responses will be encrypted using AES-GCM with RSA key exchange, following Aliyun's encryption protocol.

      Parameters:
      publicKeyId - the public key ID (null to disable encryption)
      Returns:
      this builder
    • publicKey

      public DashScopeHttpClient.Builder publicKey(String publicKey)
      Set the RSA public key for encryption (Base64-encoded).

      When both publicKeyId and publicKey are set, requests and responses will be encrypted using AES-GCM with RSA key exchange, following Aliyun's encryption protocol.

      Parameters:
      publicKey - the Base64-encoded RSA public key (null to disable encryption)
      Returns:
      this builder
    • multimodalModelPatterns

      public DashScopeHttpClient.Builder multimodalModelPatterns(Collection<String> userMultimodalPatterns)
      Set additional case-insensitive substring patterns for multimodal model detection.

      When EndpointType.AUTO routing is used, a model name matching any of these patterns (as a substring, case-insensitively) is routed to the multimodal generation API, in addition to the built-in model-name rules of DashScopeHttpClient.isMultimodalModel(String). This allows users to extend detection for models not yet covered by the built-in whitelist (e.g. "deepseek-v4.1" without waiting for a framework update).

      Example:

      
       DashScopeHttpClient client = DashScopeHttpClient.builder()
           .apiKey("sk-xxx")
           .multimodalModelPatterns(List.of("deepseek-v4"))
           .build();
       
      Parameters:
      userMultimodalPatterns - case-insensitive substring patterns (may be null)
      Returns:
      this builder
    • build

      public DashScopeHttpClient build()
      Build the DashScopeHttpClient.

      If no transport is specified, the default transport from HttpTransportFactory.getDefault() will be used, which provides automatic lifecycle management and cleanup on JVM shutdown.

      Returns:
      a new DashScopeHttpClient instance