Class DashScopeHttpClient.Builder
- Enclosing class:
- DashScopeHttpClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the API key.Set the base URL.build()Build the DashScopeHttpClient.multimodalModelPatterns(Collection<String> userMultimodalPatterns) Set additional case-insensitive substring patterns for multimodal model detection.Set the RSA public key for encryption (Base64-encoded).publicKeyId(String publicKeyId) Set the RSA public key ID for encryption.transport(io.agentscope.core.model.transport.HttpTransport transport) Set the HTTP transport.
-
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
Set the API key.- Parameters:
apiKey- the DashScope API key- Returns:
- this builder
-
baseUrl
Set the base URL.- Parameters:
baseUrl- the base URL (null for default)- Returns:
- this builder
-
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
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.AUTOrouting 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 ofDashScopeHttpClient.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
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
-