Class MessageConvertUtil
java.lang.Object
io.agentscope.core.a2a.agent.utils.MessageConvertUtil
Message Converter between Agentscope
Msg and A2A Message or Artifact.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildTypeMetadata(String type) Build metadata with content block type inPart.static io.agentscope.core.message.MsgconvertFromArtifact(io.a2a.spec.Artifact artifact, String agentName) Convert a singleArtifacttoMsg.static io.agentscope.core.message.MsgconvertFromArtifact(List<io.a2a.spec.Artifact> artifacts, String agentName) Convert a list ofArtifacttoMsg.static io.agentscope.core.message.MsgconvertFromMessage(io.a2a.spec.Message message, String agentName) Convert a singleMessagetoMsg.static io.a2a.spec.MessageconvertFromMsg(List<io.agentscope.core.message.Msg> msgs) Convert a list ofMsgtoMessage.
-
Constructor Details
-
MessageConvertUtil
public MessageConvertUtil()
-
-
Method Details
-
convertFromArtifact
public static io.agentscope.core.message.Msg convertFromArtifact(io.a2a.spec.Artifact artifact, String agentName) Convert a singleArtifacttoMsg.- Parameters:
artifact- the artifact to convertagentName- the name of the agent that generated the artifact- Returns:
- the converted Msg object
-
convertFromArtifact
public static io.agentscope.core.message.Msg convertFromArtifact(List<io.a2a.spec.Artifact> artifacts, String agentName) Convert a list ofArtifacttoMsg.- Parameters:
artifacts- the list of artifacts to convertagentName- the name of the agent that generated the artifacts- Returns:
- the converted Msg object
-
convertFromMessage
public static io.agentscope.core.message.Msg convertFromMessage(io.a2a.spec.Message message, String agentName) Convert a singleMessagetoMsg.- Parameters:
message- the message to convertagentName- the name of the agent that generated the message- Returns:
- the converted Msg object
-
convertFromMsg
Convert a list ofMsgtoMessage.- Parameters:
msgs- the list of Msg to convert- Returns:
- the converted Message object
-
buildTypeMetadata
Build metadata with content block type inPart.- Parameters:
type- the content block type, seeContentBlock.- Returns:
- metadata with content block type.
-