agentscope-ai / agentscope-ai/agentscope-java

[Bug]:DashScope API error: <400> InternalError.Algo.InvalidParameter: The input messages do not contain elements with the role of user

Open
#613 1 comment 0 reactions 0 assignees View on GitHub
area/core/model bug
Dominant language
Java
Stars
5.6k
Forks
1.3k
Avg merge
4d 12h
Merged PRs (30d)
77

Description

在调用阿里云千问qwen3-vl-plus时,顺序管道报错:DashScope API error: <400> InternalError.Algo.InvalidParameter: The input messages do not contain elements with the role of user

具体代码如下:
// 创建图片识别的智能体
ChatModelBase selectedModel = visualModelRouter.select(MaaSChannelEnum.BAI_LIAN);
ReActAgent visualAnalyzer = ReActAgent.builder()
.name("VisualAnalyzer")
.sysPrompt("你是一个专业的图片识别助手。请仔细分析图片并提供详细结果。")
.model(selectedModel)
.build();
ReActAgent dataComparisonExpert = ReActAgent.builder()
.name("DataComparisonExpert")
.sysPrompt("你是一个专业的数据比较专家。请仔细对比图片中的数据与给定的数据,提供详细对比结果。")
.model(selectedModel)
.build();
// 组装输入内容
List contents = new ArrayList<>();
contents.add(ImageBlock.builder()
.source(URLSource.builder().url(param.getImageUrl()).build())
.build());
contents.add(TextBlock.builder().text(contrastJsonData).build());
// 设置输入内容
Msg input = Msg.builder()
.name("user")
.role(MsgRole.USER)
.content(contents)
.build();
// 执行智能体
Msg response = Pipelines.sequential(List.of(visualAnalyzer, dataComparisonExpert), input).block();
// 获取结构化输出
PoundDto poundDto = null;
if (response != null) {
poundDto = response.getStructuredData(PoundDto.class);
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.