AS AgentScopeAPI 手册 / API Reference

DashScopeMessage

@JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DashScopeMessage
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:53–228

DashScope 消息,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.dashscope.dto 包。核心成员包括 getRole、setRole、getContent、setContent、getContentAsString、getContentAsList。

DashScope message DTO.

This class represents a message in the DashScope API format. Content can be either a String (for text-only) or a List of DashScopeContentPart (for multimodal).

Example text message:

`{
"role": "user",
"content": "Hello"
}
`

Example multimodal message:

`{
"role": "user",
"content": [
{"text": "What's in this image?"},
{"image": "https://example.com/image.jpg"}
]
}
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
A class in io.agentscope.extensions.model.dashscope.dto that talks to model services and returns generated or embedded output.

构造器摘要Constructor Summary

构造器Constructor说明Description
public DashScopeMessage()
初始化 `DashScopeMessage` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getRole()
获取角色。
Returns the role.
public void setRole(String role)
设置角色。
Sets the role.
public Object getContent()
获取内容。
Returns the content.
public void setContent(Object content)
设置内容。
Sets the content.
public String getContentAsString()
获取 `getContentAsString`。
Get content as String (for text-only messages).
public List<DashScopeContentPart> getContentAsList()
获取内容 as 列出(用于多模态消息)。
Get content as List (for multimodal messages).
public boolean isMultimodal()
检查if 此消息有多模态内容。
Check if this message has multimodal content.
public String getName()
获取名称。
Returns the name.
public void setName(String name)
设置名称。
Sets the name.
public String getToolCallId()
获取工具调用标识。
Returns the tool call id.
public void setToolCallId(String toolCallId)
设置工具调用标识。
Sets the tool call id.
public List<DashScopeToolCall> getToolCalls()
获取工具调用。
Returns the tool calls.
public void setToolCalls(List<DashScopeToolCall> toolCalls)
设置工具调用。
Sets the tool calls.
public String getReasoningContent()
获取推理内容。
Returns the reasoning content.
public void setReasoningContent(String reasoningContent)
设置推理内容。
Sets the reasoning content.
public static Builder builder()
static
返回构建器实例。
Returns the builder.

构造器详情Constructor Detail

DashScopeMessage

public DashScopeMessage()

初始化 DashScopeMessage 实例。

Creates a new instance.

源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:85

方法详情Method Detail

getRole

public String getRole()

获取角色。

Returns the role.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:87–89

setRole

public void setRole(String role)

设置角色。

Sets the role.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:91–93

getContent

public Object getContent()

获取内容。

Returns the content.

返回Returns Object
返回对象。Returns object.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:95–97

setContent

public void setContent(Object content)

设置内容。

Sets the content.

参数Parameters
名称Name类型Type说明Description
contentObject内容(类型 `Object`)。The content.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:99–101

getContentAsString

public String getContentAsString()

获取 getContentAsString。

Get content as String (for text-only messages).

返回Returns String
返回字符串结果。the content as String, or null if multimodal
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:108–124

getContentAsList

public List<DashScopeContentPart> getContentAsList()

获取内容 as 列出(用于多模态消息)。

Get content as List (for multimodal messages).

返回Returns List<DashScopeContentPart>
返回列出。the content as List, or null if text-only
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:131–138

isMultimodal

public boolean isMultimodal()

检查if 此消息有多模态内容。

Check if this message has multimodal content.

返回Returns boolean
返回布尔值,表示判断结果。true if content is a List
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:145–148

getName

public String getName()

获取名称。

Returns the name.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:150–152

setName

public void setName(String name)

设置名称。

Sets the name.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:154–156

getToolCallId

public String getToolCallId()

获取工具调用标识。

Returns the tool call id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:158–160

setToolCallId

public void setToolCallId(String toolCallId)

设置工具调用标识。

Sets the tool call id.

参数Parameters
名称Name类型Type说明Description
toolCallIdString工具调用标识(类型 `String`)。The tool call id.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:162–164

getToolCalls

public List<DashScopeToolCall> getToolCalls()

获取工具调用。

Returns the tool calls.

返回Returns List<DashScopeToolCall>
返回列出。Returns list.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:166–168

setToolCalls

public void setToolCalls(List<DashScopeToolCall> toolCalls)

设置工具调用。

Sets the tool calls.

参数Parameters
名称Name类型Type说明Description
toolCallsList<DashScopeToolCall>工具调用(类型 `List`)。The tool calls.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:170–172

getReasoningContent

public String getReasoningContent()

获取推理内容。

Returns the reasoning content.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:174–176

setReasoningContent

public void setReasoningContent(String reasoningContent)

设置推理内容。

Sets the reasoning content.

参数Parameters
名称Name类型Type说明Description
reasoningContentString推理内容(类型 `String`)。The reasoning content.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:178–180

builder

public static Builder builder()
static

返回构建器实例。

Returns the builder.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:182–184

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.dashscope.dto 包。核心成员包括 role、content、name、toolCallId、toolCalls、reasoningContent。

A class in io.agentscope.extensions.model.dashscope.dto that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.dashscope.dto.

基于官方固定版本源码静态生成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.