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

未关闭
#613 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area/core/model bug
主要语言
Java
星标
5.6k
派生
1.3k
平均合并
4 天 12 小时
30 天内合并 PR
77

描述

在调用阿里云千问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);
}

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。