AS AgentScopeAPI 手册 / API Reference

MessageAdapter

public interface MessageAdapter
源码Source 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.

参数Parameters
名称Name类型Type说明Description
frameworkMsgObjectframework 消息(类型 `Object`)。Framework-specific message object or list of message objects
返回Returns List<Message>
返回列出。List of runtime Message objects
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if the input is not of the expected type
源码Source io/agentscope/runtime/adapters/MessageAdapter.java:50

messageToFrameworkMsg

public Object messageToFrameworkMsg(Object messages)

设置该参数。

Convert runtime Message(s) to framework-specific message format.

参数Parameters
名称Name类型Type说明Description
messagesObject消息列表(类型 `Object`)。Runtime Message(s) - single Message or List
返回Returns Object
返回对象。Framework-specific message object(s) - single message or List of messages
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if the input is not of the expected type
源码Source io/agentscope/runtime/adapters/MessageAdapter.java:64
基于官方固定版本源码静态生成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.