AS AgentScopeAPI 手册 / API Reference

ContextMessage

public record ContextMessage(String role, String content, boolean isCompaction)
源码Source io/agentscope/extensions/controlplane/model/ContextSnapshot.java:287–302

承载上下文消息数据的记录类型。位于 io.agentscope.extensions.controlplane.model 包。核心成员包括 role、content、isCompaction、of。

One message in the effective context.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
roleString
执行角色相关操作。
Performs the role operation.
contentString
执行内容相关操作。
Performs the content operation.
isCompactionboolean
判断是否压缩。
Returns whether the compaction.

方法摘要Method Summary

方法Method说明Description
public static ContextMessage of(String role, String content)
static
创建并返回实例。
Creates and returns an instance.

记录组件详情Record Component Detail

role

String role

执行角色相关操作。

Performs the role operation.

源码Source io/agentscope/extensions/controlplane/model/ContextSnapshot.java:287–302

content

String content

执行内容相关操作。

Performs the content operation.

源码Source io/agentscope/extensions/controlplane/model/ContextSnapshot.java:287–302

isCompaction

boolean isCompaction

判断是否压缩。

Returns whether the compaction.

源码Source io/agentscope/extensions/controlplane/model/ContextSnapshot.java:287–302

方法详情Method Detail

of

public static ContextMessage of(String role, String content)
static

创建并返回实例。

Creates and returns an instance.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role.
contentString内容(类型 `String`)。The content.
返回Returns ContextMessage
返回ContextMessage。Returns context message.
源码Source io/agentscope/extensions/controlplane/model/ContextSnapshot.java:289–291
基于官方固定版本源码静态生成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.