DashScopeMessage
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class DashScopeMessage
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:53–228DashScope 消息,与模型服务通信并返回生成或向量化结果。位于 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
构造器详情Constructor Detail
DashScopeMessage
public DashScopeMessage()
初始化 DashScopeMessage 实例。
Creates a new instance.
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:85方法详情Method Detail
getRole
public String getRole()
获取角色。
Returns the role.
Stringio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:87–89setRole
public void setRole(String role)
设置角色。
Sets the role.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
role | String | 角色(类型 `String`)。The role. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:91–93getContent
public Object getContent()
获取内容。
Returns the content.
Objectio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:95–97setContent
public void setContent(Object content)
设置内容。
Sets the content.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
content | Object | 内容(类型 `Object`)。The content. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:99–101getContentAsString
public String getContentAsString()
获取 getContentAsString。
Get content as String (for text-only messages).
Stringio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:108–124getContentAsList
public List<DashScopeContentPart> getContentAsList()
获取内容 as 列出(用于多模态消息)。
Get content as List (for multimodal messages).
List<DashScopeContentPart>io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:131–138isMultimodal
public boolean isMultimodal()
检查if 此消息有多模态内容。
Check if this message has multimodal content.
booleanio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:145–148getName
public String getName()
获取名称。
Returns the name.
Stringio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:150–152setName
public void setName(String name)
设置名称。
Sets the name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:154–156getToolCallId
public String getToolCallId()
获取工具调用标识。
Returns the tool call id.
Stringio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:158–160setToolCallId
public void setToolCallId(String toolCallId)
设置工具调用标识。
Sets the tool call id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCallId | String | 工具调用标识(类型 `String`)。The tool call id. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:162–164getToolCalls
public List<DashScopeToolCall> getToolCalls()
获取工具调用。
Returns the tool calls.
List<DashScopeToolCall>io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:166–168setToolCalls
public void setToolCalls(List<DashScopeToolCall> toolCalls)
设置工具调用。
Sets the tool calls.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCalls | List<DashScopeToolCall> | 工具调用(类型 `List`)。The tool calls. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:170–172getReasoningContent
public String getReasoningContent()
获取推理内容。
Returns the reasoning content.
Stringio/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:174–176setReasoningContent
public void setReasoningContent(String reasoningContent)
设置推理内容。
Sets the reasoning content.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reasoningContent | String | 推理内容(类型 `String`)。The reasoning content. |
io/agentscope/extensions/model/dashscope/dto/DashScopeMessage.java:178–180builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/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.