Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import io.agentscope.core.formatter.dashscope.dto.DashScopeFunction;
import io.agentscope.core.formatter.dashscope.dto.DashScopeParameters;
import io.agentscope.core.formatter.dashscope.dto.DashScopeResponseFormat;
import io.agentscope.core.formatter.dashscope.dto.DashScopeTool;
import io.agentscope.core.formatter.dashscope.dto.DashScopeToolCall;
import io.agentscope.core.formatter.dashscope.dto.DashScopeToolFunction;
Expand Down Expand Up @@ -96,6 +97,12 @@ public void applyOptions(
if (presencePenalty != null) {
params.setPresencePenalty(presencePenalty);
}

DashScopeResponseFormat responseFormat =
getOption(options, defaultOptions, GenerateOptions::getResponseFormat);
if (responseFormat != null) {
params.setResponseFormat(responseFormat);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public class DashScopeParameters {
@JsonProperty("repetition_penalty")
private Double repetitionPenalty;

/** The configuration for the llm response format. */
@JsonProperty("response_format")
DashScopeResponseFormat responseFormat;

public DashScopeParameters() {}

public String getResultFormat() {
Expand Down Expand Up @@ -224,6 +228,14 @@ public void setRepetitionPenalty(Double repetitionPenalty) {
this.repetitionPenalty = repetitionPenalty;
}

public DashScopeResponseFormat getResponseFormat() {
return responseFormat;
}

public void setResponseFormat(DashScopeResponseFormat responseFormat) {
this.responseFormat = responseFormat;
}

public static Builder builder() {
return new Builder();
}
Expand Down Expand Up @@ -306,6 +318,11 @@ public Builder repetitionPenalty(Double repetitionPenalty) {
return this;
}

public Builder responseFormat(DashScopeResponseFormat responseFormat) {
params.setResponseFormat(responseFormat);
return this;
}

public DashScopeParameters build() {
return params;
}
Expand Down
Loading
Loading