AS AgentScopeAPI 手册 / API Reference

DashScopeMessageConverter

public class DashScopeMessageConverter
源码Source io/agentscope/extensions/model/dashscope/formatter/DashScopeMessageConverter.java:45–358

DashScope 消息转换器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.dashscope.formatter 包。核心成员包括 convertToMessage、DashScopeMessageConverter。

Converts AgentScope Msg objects to DashScope DTO message types.

This class provides unified conversion methods for both simple text messages and multimodal messages containing images, videos, and audio.

构造器摘要Constructor Summary

构造器Constructor说明Description
public DashScopeMessageConverter(Function<List<ContentBlock>, String> toolResultConverter)
初始化 `DashScopeMessageConverter` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public DashScopeMessage convertToMessage(Msg msg, boolean useMultimodalFormat)
转换到消息。
Convert single Msg to DashScopeMessage.

构造器详情Constructor Detail

DashScopeMessageConverter

public DashScopeMessageConverter(Function<List<ContentBlock>, String> toolResultConverter)

初始化 DashScopeMessageConverter 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
toolResultConverterFunction<List<ContentBlock>, String>工具结果转换器(类型 `Function , String>`)。The tool result converter.
源码Source io/agentscope/extensions/model/dashscope/formatter/DashScopeMessageConverter.java:53–57

方法详情Method Detail

convertToMessage

public DashScopeMessage convertToMessage(Msg msg, boolean useMultimodalFormat)

转换到消息。

Convert single Msg to DashScopeMessage.

参数Parameters
名称Name类型Type说明Description
msgMsg消息到转换。The message to convert
useMultimodalFormatboolean使用多模态格式(类型 `boolean`)。Whether to use multimodal content format (List of content parts)
返回Returns DashScopeMessage
已转换 DashScopeMessage。The converted DashScopeMessage
源码Source io/agentscope/extensions/model/dashscope/formatter/DashScopeMessageConverter.java:69–81
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.