Builder
public static final class Builder extends Msg.Builder
源码Source
io/agentscope/core/message/SystemMessage.java:94–171构建器,用于构建并配置目标实例。位于 io.agentscope.core.message 包,继承自 Msg.Builder。核心成员包括 role、id、name、content、textContent、metadata。
Fluent builder for SystemMessage. The role is fixed to
MsgRole#SYSTEM and #role(MsgRole) is unsupported.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public Builder() | 初始化 `Builder` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder role(MsgRole role) | 设置角色。 Unsupported on `SystemMessage.Builder`: role is fixed to SYSTEM. |
public Builder id(String id) | 设置标识。 Performs the id operation. |
public Builder name(String name) | 设置名称。 Performs the name operation. |
public Builder content(List<ContentBlock> content) | 设置内容。 Performs the content operation. |
public Builder content(ContentBlock block) | 设置内容。 Performs the content operation. |
public Builder content(ContentBlock... blocks) | 设置内容。 Performs the content operation. |
public Builder textContent(String text) | 设置文本内容。 Performs the text content operation. |
public Builder metadata(Map<String, Object> metadata) | 设置元数据。 Performs the metadata operation. |
public Builder timestamp(String timestamp) | 设置时间戳。 Performs the timestamp operation. |
public Builder usage(ChatUsage usage) | 设置用量。 Performs the usage operation. |
public Builder generateReason(GenerateReason reason) | 设置该配置项。 Performs the generate reason operation. |
public SystemMessage build() | 构建并返回最终实例。 Creates and returns an instance. |
构造器详情Constructor Detail
Builder
public Builder()
初始化 Builder 实例。
Creates a new instance.
源码Source
io/agentscope/core/message/SystemMessage.java:96–98方法详情Method Detail
role
public Builder role(MsgRole role)
设置角色。
Unsupported on SystemMessage.Builder: role is fixed to SYSTEM.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
role | MsgRole | 角色(类型 `MsgRole`)。The role. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:101–105id
public Builder id(String id)
设置标识。
Performs the id operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:107–111name
public Builder name(String name)
设置名称。
Performs the name operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:113–117content
public Builder content(List<ContentBlock> content)
设置内容。
Performs the content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
content | List<ContentBlock> | 内容(类型 `List`)。The content. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:119–123content
public Builder content(ContentBlock block)
设置内容。
Performs the content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
block | ContentBlock | 内容块(类型 `ContentBlock`)。The block. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:125–129content
public Builder content(ContentBlock... blocks)
设置内容。
Performs the content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
blocks varargs | ContentBlock... | 内容块列表(类型 `ContentBlock...`)。The blocks. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:131–135textContent
public Builder textContent(String text)
设置文本内容。
Performs the text content operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
text | String | 文本(类型 `String`)。The text. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:137–141metadata
public Builder metadata(Map<String, Object> metadata)
设置元数据。
Performs the metadata operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metadata | Map<String, Object> | 元数据(类型 `Map`)。The metadata. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:143–147timestamp
public Builder timestamp(String timestamp)
设置时间戳。
Performs the timestamp operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timestamp | String | 时间戳(类型 `String`)。The timestamp. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:149–153usage
public Builder usage(ChatUsage usage)
设置用量。
Performs the usage operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
usage | ChatUsage | 用量(类型 `ChatUsage`)。The usage. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:155–159generateReason
public Builder generateReason(GenerateReason reason)
设置该配置项。
Performs the generate reason operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reason | GenerateReason | 原因(类型 `GenerateReason`)。The reason. |
Builder返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source
io/agentscope/core/message/SystemMessage.java:161–165build
public SystemMessage build()
构建并返回最终实例。
Creates and returns an instance.
SystemMessage返回SystemMessage。Returns system message.
源码Source
io/agentscope/core/message/SystemMessage.java:167–170