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

Aperta
#613 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
area/core/model bug
Lingua principale
Java
Stelle
5.6k
Fork
1.3k
Merge medio
4g 12h
PR unite (30g)
77

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.