AS AgentScopeAPI 手册 / API Reference

Message

public class Message extends Event
源码Source io/agentscope/runtime/engine/schemas/Message.java:28–187

表示消息 in 智能体运行时。位于 io.agentscope.runtime.engine.schemas 包,继承自 Event。核心成员包括 getId、setId、getObject、setObject、getType、setType。

Represents a message in the agent runtime.

构造器摘要Constructor Summary

构造器Constructor说明Description
public Message()
初始化 `Message` 实例。
Creates a new instance.
public Message(String type, String role)
初始化 `Message` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getId()
获取标识。
Returns the id.
public void setId(String id)
设置标识。
Sets the id.
public String getObject()
获取对象。
Returns the object.
public void setObject(String object)
设置对象。
Sets the object.
public String getType()
获取类型。
Returns the type.
public void setType(String type)
设置类型。
Sets the type.
public String getRole()
获取角色。
Returns the role.
public void setRole(String role)
设置角色。
Sets the role.
public List<Content> getContent()
获取内容。
Returns the content.
public void setContent(List<Content> content)
设置内容。
Sets the content.
public String getCode()
获取 `getCode`。
Returns the code.
public void setCode(String code)
设置 `setCode`。
Sets the code.
public String getMessage()
获取消息。
Returns the message.
public void setMessage(String message)
设置消息。
Sets the message.
public Map<String, Object> getUsage()
获取用量。
Returns the usage.
public void setUsage(Map<String, Object> usage)
设置用量。
Sets the usage.
public Map<String, Object> getMetadata()
获取元数据。
Returns the metadata.
public void setMetadata(Map<String, Object> metadata)
设置元数据。
Sets the metadata.
public Content addDeltaContent(Content newContent)
添加增量内容。
Adds delta content to the message.
public Message inProgress()
将响应状态设置为进行中。
Marks the message as in progress.
public Message completed()
返回已完成。
Marks the message as completed.

构造器详情Constructor Detail

Message

public Message()

初始化 Message 实例。

Creates a new instance.

源码Source io/agentscope/runtime/engine/schemas/Message.java:56–60

Message

public Message(String type, String role)

初始化 Message 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
typeString类型(类型 `String`)。The type.
roleString角色(类型 `String`)。The role.
源码Source io/agentscope/runtime/engine/schemas/Message.java:62–66

方法详情Method Detail

getId

public String getId()

获取标识。

Returns the id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:69–71

setId

public void setId(String id)

设置标识。

Sets the id.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
源码Source io/agentscope/runtime/engine/schemas/Message.java:73–75

getObject

public String getObject()

获取对象。

Returns the object.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:77–79

setObject

public void setObject(String object)

设置对象。

Sets the object.

参数Parameters
名称Name类型Type说明Description
objectString对象(类型 `String`)。The object.
源码Source io/agentscope/runtime/engine/schemas/Message.java:81–83

getType

public String getType()

获取类型。

Returns the type.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:85–87

setType

public void setType(String type)

设置类型。

Sets the type.

参数Parameters
名称Name类型Type说明Description
typeString类型(类型 `String`)。The type.
源码Source io/agentscope/runtime/engine/schemas/Message.java:89–91

getRole

public String getRole()

获取角色。

Returns the role.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:93–95

setRole

public void setRole(String role)

设置角色。

Sets the role.

参数Parameters
名称Name类型Type说明Description
roleString角色(类型 `String`)。The role.
源码Source io/agentscope/runtime/engine/schemas/Message.java:97–99

getContent

public List<Content> getContent()

获取内容。

Returns the content.

返回Returns List<Content>
返回列出。Returns list.
源码Source io/agentscope/runtime/engine/schemas/Message.java:101–103

setContent

public void setContent(List<Content> content)

设置内容。

Sets the content.

参数Parameters
名称Name类型Type说明Description
contentList<Content>内容(类型 `List`)。The content.
源码Source io/agentscope/runtime/engine/schemas/Message.java:105–107

getCode

public String getCode()

获取 getCode。

Returns the code.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:109–111

setCode

public void setCode(String code)

设置 setCode。

Sets the code.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
源码Source io/agentscope/runtime/engine/schemas/Message.java:113–115

getMessage

public String getMessage()

获取消息。

Returns the message.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Message.java:117–119

setMessage

public void setMessage(String message)

设置消息。

Sets the message.

参数Parameters
名称Name类型Type说明Description
messageString消息(类型 `String`)。The message.
源码Source io/agentscope/runtime/engine/schemas/Message.java:121–123

getUsage

public Map<String, Object> getUsage()

获取用量。

Returns the usage.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/engine/schemas/Message.java:125–127

setUsage

public void setUsage(Map<String, Object> usage)

设置用量。

Sets the usage.

参数Parameters
名称Name类型Type说明Description
usageMap<String, Object>用量(类型 `Map`)。The usage.
源码Source io/agentscope/runtime/engine/schemas/Message.java:129–131

getMetadata

public Map<String, Object> getMetadata()

获取元数据。

Returns the metadata.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/engine/schemas/Message.java:133–135

setMetadata

public void setMetadata(Map<String, Object> metadata)

设置元数据。

Sets the metadata.

参数Parameters
名称Name类型Type说明Description
metadataMap<String, Object>元数据(类型 `Map`)。The metadata.
源码Source io/agentscope/runtime/engine/schemas/Message.java:137–139

addDeltaContent

public Content addDeltaContent(Content newContent)

添加增量内容。

Adds delta content to the message.

参数Parameters
名称Name类型Type说明Description
newContentContent新建内容(类型 `Content`)。The new content.
返回Returns Content
返回内容。Returns content.
源码Source io/agentscope/runtime/engine/schemas/Message.java:144–170

inProgress

public Message inProgress()

将响应状态设置为进行中。

Marks the message as in progress.

返回Returns Message
返回消息。Returns message.
源码Source io/agentscope/runtime/engine/schemas/Message.java:175–178

completed

public Message completed()

返回已完成。

Marks the message as completed.

返回Returns Message
返回消息。Returns message.
源码Source io/agentscope/runtime/engine/schemas/Message.java:183–186

继承成员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.