AS AgentScopeAPI 手册 / API Reference
类class agentscope.formatter

MoonshotMultiAgentFormatter

class MoonshotMultiAgentFormatter(_OpenAIFormatterBase)
源码Source agentscope/formatter/_moonshot_formatter.py:312–468

Moonshot Multi 智能体格式化器,在智能体、模型与前端之间传递结构化消息和事件。位于 agentscope.formatter 包,继承自 _OpenAIFormatterBase。核心成员包括 format。

Moonshot's API is OpenAI-compatible, so the multi-agent history collapsing strategy is the same as :class:OpenAIMultiAgentFormatter. Tool sequences are delegated to :class:MoonshotChatFormatter so that reasoning_content is preserved correctly for multi-turn Preserved Thinking conversations.

属性摘要Attribute Summary

属性Attribute类型Type说明Description值Value
conversation_history_promptstr
会话历史提示词字段。
Field(default='# Conversation History\nThe content between <history></history> tags contains your conversation history\n', description='The prompt to use for the conversation history section.')
input_typeslist[str]
输入类型字段。
Field(default_factory=lambda: ['text/plain', 'image/*', 'audio/*', 'video/*'], description='The supported input types. Defaults to ``["text/plain", "image/*", "audio/*", "video/*"]``.')

方法摘要Method Summary

方法Method说明Description
async def format(msgs: list[Msg]) -> list[dict[str, Any]]async
设置格式。
Format input messages into the Moonshot AI API format for multi-agent conversations.

属性详情Attribute Detail

conversation_history_prompt

str = Field(default='# Conversation History\nThe content between <history></history> tags contains your conversation history\n', description='The prompt to use for the conversation history section.')

会话历史提示词字段。声明为 str。

The prompt to use for the conversation history section.

源码Source agentscope/formatter/_moonshot_formatter.py:326

input_types

list[str] = Field(default_factory=lambda: ['text/plain', 'image/*', 'audio/*', 'video/*'], description='The supported input types. Defaults to ``["text/plain", "image/*", "audio/*", "video/*"]``.')

输入类型字段。声明为 list[str]。

The supported input types.

源码Source agentscope/formatter/_moonshot_formatter.py:335

方法详情Method Detail

format

async def format(msgs: list[Msg]) -> list[dict[str, Any]]
async

设置格式。

Non-tool messages from all agents are collapsed into a single user message with tags.

参数Parameters
名称Name类型Type说明Description
msgslist[Msg]消息列表(类型 `list[Msg]`)。The list of message objects to format.
返回Returns list[dict[str, Any]]
返回dict[str,任意]列表。`list[dict[str, Any]]`:
源码Source agentscope/formatter/_moonshot_formatter.py:366–408
基于官方固定版本源码静态生成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.