MessageAdapter
public interface MessageAdapter
io/agentscope/runtime/adapters/MessageAdapter.java:37–65定义消息适配器契约的接口。位于 io.agentscope.runtime.adapters 包。核心成员包括 frameworkMsgToMessage、messageToFrameworkMsg。
MessageAdapter interface provides a unified abstraction for converting messages between framework-specific message formats and runtime Message objects.
This interface is designed to adapt different Agent Framework message types (e.g., AgentScope Msg, AutoGen Message, etc.) to and from the runtime's standardized Message format.
Implementations should handle:
-
Converting framework-specific messages to runtime Message objects
-
Converting runtime Message objects back to framework-specific format
-
Handling both single messages and lists of messages
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public List<Message> frameworkMsgToMessage(Object frameworkMsg) | 设置该参数。 Convert framework-specific message(s) into one or more runtime Message objects. |
public Object messageToFrameworkMsg(Object messages) | 设置该参数。 Convert runtime Message(s) to framework-specific message format. |
方法详情Method Detail
frameworkMsgToMessage
public List<Message> frameworkMsgToMessage(Object frameworkMsg)
设置该参数。
Convert framework-specific message(s) into one or more runtime Message objects.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
frameworkMsg | Object | framework 消息(类型 `Object`)。Framework-specific message object or list of message objects |
List<Message>IllegalArgumentException可能抛出 `IllegalArgumentException`。if the input is not of the expected type
io/agentscope/runtime/adapters/MessageAdapter.java:50messageToFrameworkMsg
public Object messageToFrameworkMsg(Object messages)
设置该参数。
Convert runtime Message(s) to framework-specific message format.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messages | Object | 消息列表(类型 `Object`)。Runtime Message(s) - single Message or List |
ObjectIllegalArgumentException可能抛出 `IllegalArgumentException`。if the input is not of the expected type
io/agentscope/runtime/adapters/MessageAdapter.java:64