AS AgentScopeAPI 手册 / API Reference

SystemMessage

public final class SystemMessage extends Msg
源码Source io/agentscope/core/message/SystemMessage.java:35–172

系统消息,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.message 包,继承自 Msg。核心成员包括 builder、SystemMessage。

A Msg with MsgRole#SYSTEM pinned at construction time.

Provides convenience constructors that take a String directly (wrapped into a TextBlock). System messages are restricted to text blocks by Msg's validator; passing non-text blocks will throw IllegalArgumentException.

Also offers an independent Builder for cases that need to set metadata, timestamp, usage or generateReason.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
Fluent builder for `SystemMessage`.

构造器摘要Constructor Summary

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

方法摘要Method Summary

方法Method说明Description
public static Builder builder()
static
返回构建器实例。
Creates a builder for `SystemMessage` with a randomly generated ID and the current timestamp pre-populated.

构造器详情Constructor Detail

SystemMessage

public SystemMessage(String text)

初始化 SystemMessage 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
textString文本(类型 `String`)。The text.
源码Source io/agentscope/core/message/SystemMessage.java:37–39

SystemMessage

public SystemMessage(String name, String text)

初始化 SystemMessage 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
textString文本(类型 `String`)。The text.
源码Source io/agentscope/core/message/SystemMessage.java:41–50

SystemMessage

public SystemMessage(ContentBlock... blocks)

初始化 SystemMessage 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
blocks varargsContentBlock...内容块列表(类型 `ContentBlock...`)。The blocks.
源码Source io/agentscope/core/message/SystemMessage.java:52–54

SystemMessage

public SystemMessage(String name, ContentBlock... blocks)

初始化 SystemMessage 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
nameString名称(类型 `String`)。The name.
blocks varargsContentBlock...内容块列表(类型 `ContentBlock...`)。The blocks.
源码Source io/agentscope/core/message/SystemMessage.java:56–65

SystemMessage

public SystemMessage(List<ContentBlock> blocks)

初始化 SystemMessage 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
blocksList<ContentBlock>内容块列表(类型 `List`)。The blocks.
源码Source io/agentscope/core/message/SystemMessage.java:67–69

方法详情Method Detail

builder

public static Builder builder()
static

返回构建器实例。

Creates a builder for SystemMessage with a randomly generated ID and the current timestamp pre-populated.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/message/SystemMessage.java:86–88

嵌套类详情Nested Class Detail

Builder

public static final class Builder extends Msg.Builder

构建器,用于构建并配置目标实例。位于 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.

继承成员Inherited Members

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