AS AgentScopeAPI 手册 / API Reference

MessageConvertUtil

public class MessageConvertUtil
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:40–279

消息转换 Util,支持智能体之间的发现、委派与协作。位于 io.agentscope.core.a2a.agent.utils 包。核心成员包括 convertFromArtifact、convertFromMessage、convertFromMsg、buildTypeMetadata。

Message Converter between Agentscope Msg and A2A Message or Artifact.

方法摘要Method Summary

方法Method说明Description
public static Msg convertFromArtifact(Artifact artifact, String agentName)
static
转换 `convertFromArtifact`。
Convert a single `Artifact` to `Msg`.
public static Msg convertFromArtifact(List<Artifact> artifacts, String agentName)
static
转换列出的`Artifact`到`Msg`。
Convert a list of `Artifact` to `Msg`.
public static Msg convertFromMessage(Message message, String agentName)
static
转换来自消息。
Convert a single `Message` to `Msg`.
public static Message convertFromMsg(List<Msg> msgs)
static
转换列出的`Msg`到`Message`。
Convert a list of `Msg` to `Message`.
public static Map<String, Object> buildTypeMetadata(String type)
static
构建元数据使用内容块类型 in`Part`。
Build metadata with content block type in `Part`.

方法详情Method Detail

convertFromArtifact

public static Msg convertFromArtifact(Artifact artifact, String agentName)
static

转换 convertFromArtifact。

Convert a single Artifact to Msg.

参数Parameters
名称Name类型Type说明Description
artifactArtifactartifact(类型 `Artifact`)。the artifact to convert
agentNameString智能体名称(类型 `String`)。the name of the agent that generated the artifact
返回Returns Msg
已转换消息对象。the converted Msg object
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:54–56

convertFromArtifact

public static Msg convertFromArtifact(List<Artifact> artifacts, String agentName)
static

转换列出的Artifact到Msg。

Convert a list of Artifact to Msg.

参数Parameters
名称Name类型Type说明Description
artifactsList<Artifact>artifacts(类型 `List`)。the list of artifacts to convert
agentNameString智能体名称(类型 `String`)。the name of the agent that generated the artifacts
返回Returns Msg
已转换消息对象。the converted Msg object
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:65–81

convertFromMessage

public static Msg convertFromMessage(Message message, String agentName)
static

转换来自消息。

Convert a single Message to Msg.

参数Parameters
名称Name类型Type说明Description
messageMessage消息到转换。the message to convert
agentNameString智能体名称(类型 `String`)。the name of the agent that generated the message
返回Returns Msg
已转换消息对象。the converted Msg object
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:90–98

convertFromMsg

public static Message convertFromMsg(List<Msg> msgs)
static

转换列出的Msg到Message。

Convert a list of Msg to Message.

参数Parameters
名称Name类型Type说明Description
msgsList<Msg>消息到转换的列出。the list of Msg to convert
返回Returns Message
已转换消息对象。the converted Message object
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:106–145

buildTypeMetadata

public static Map<String, Object> buildTypeMetadata(String type)
static

构建元数据使用内容块类型 inPart。

Build metadata with content block type in Part.

参数Parameters
名称Name类型Type说明Description
typeString类型(类型 `String`)。the content block type, see `ContentBlock`.
返回Returns Map<String, Object>
返回映射。metadata with content block type.
源码Source io/agentscope/core/a2a/agent/utils/MessageConvertUtil.java:274–278
基于官方固定版本源码静态生成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.