diff --git a/agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/dto/DashScopeRequest.java b/agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/dto/DashScopeRequest.java index 7e0ff028a..af43b1947 100644 --- a/agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/dto/DashScopeRequest.java +++ b/agentscope-core/src/main/java/io/agentscope/core/formatter/dashscope/dto/DashScopeRequest.java @@ -15,8 +15,10 @@ */ package io.agentscope.core.formatter.dashscope.dto; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import io.agentscope.core.model.EndpointType; /** * DashScope API request DTO. @@ -53,12 +55,23 @@ public class DashScopeRequest { @JsonProperty("parameters") private DashScopeParameters parameters; - public DashScopeRequest() {} + /** + * The endpoint type for endpoint selection (not serialized to JSON). + * + *

This is an internal field used to determine which DashScope API endpoint to use. + * It does not get sent to the API. + */ + @JsonIgnore private EndpointType endpointType; + + public DashScopeRequest() { + this.endpointType = EndpointType.AUTO; + } public DashScopeRequest(String model, DashScopeInput input, DashScopeParameters parameters) { this.model = model; this.input = input; this.parameters = parameters; + this.endpointType = EndpointType.AUTO; } public String getModel() { @@ -85,6 +98,24 @@ public void setParameters(DashScopeParameters parameters) { this.parameters = parameters; } + /** + * Gets the endpoint type for endpoint selection. + * + * @return the endpoint type (defaults to AUTO) + */ + public EndpointType getEndpointType() { + return endpointType; + } + + /** + * Sets the endpoint type for endpoint selection. + * + * @param endpointType the endpoint type + */ + public void setEndpointType(EndpointType endpointType) { + this.endpointType = endpointType; + } + public static Builder builder() { return new Builder(); } @@ -93,6 +124,7 @@ public static class Builder { private String model; private DashScopeInput input; private DashScopeParameters parameters; + private EndpointType endpointType = EndpointType.AUTO; public Builder model(String model) { this.model = model; @@ -109,8 +141,21 @@ public Builder parameters(DashScopeParameters parameters) { return this; } + /** + * Sets the endpoint type for endpoint selection. + * + * @param endpointType the endpoint type + * @return this builder + */ + public Builder endpointType(EndpointType endpointType) { + this.endpointType = endpointType; + return this; + } + public DashScopeRequest build() { - return new DashScopeRequest(model, input, parameters); + DashScopeRequest request = new DashScopeRequest(model, input, parameters); + request.setEndpointType(endpointType); + return request; } } } diff --git a/agentscope-core/src/main/java/io/agentscope/core/model/DashScopeChatModel.java b/agentscope-core/src/main/java/io/agentscope/core/model/DashScopeChatModel.java index 6d381647d..4991665c4 100644 --- a/agentscope-core/src/main/java/io/agentscope/core/model/DashScopeChatModel.java +++ b/agentscope-core/src/main/java/io/agentscope/core/model/DashScopeChatModel.java @@ -37,11 +37,8 @@ *

This implementation uses direct HTTP calls to DashScope API via OkHttp, * without depending on the DashScope Java SDK. * - *

Supports both text and vision models through automatic endpoint routing: - *

+ *

Supports both text and vision models through automatic endpoint routing. + * Use {@link EndpointType} to explicitly control the endpoint selection. * *

Features: *