类class
agentscope.formatterDashScopeMultiAgentFormatter
class DashScopeMultiAgentFormatter(_DashScopeFormatterBase)
源码Source
agentscope/formatter/_dashscope_formatter.py:418–577DashScope Multi 智能体格式化器,在智能体、模型与前端之间传递结构化消息和事件。位于 agentscope.formatter 包,继承自 _DashScopeFormatterBase。核心成员包括 format。
.. tip:: Telling the assistant's name in the system prompt is very important in multi-agent conversations. So that LLM can know who it is playing as.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
conversation_history_prompt | str | 会话历史提示词。 | Field(description='The conversation history prompt.', default='# Conversation History\nThe content between <history></history> tags contains your conversation history\n') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def format(msgs: list[Msg]) -> list[dict]async | 设置格式。 Format input messages into the structure required by the DashScope OpenAI-compatible API. |
属性详情Attribute Detail
conversation_history_prompt
str = Field(description='The conversation history prompt.', default='# Conversation History\nThe content between <history></history> tags contains your conversation history\n')会话历史提示词。
The conversation history prompt.
源码Source
agentscope/formatter/_dashscope_formatter.py:435方法详情Method Detail
format
async def format(msgs: list[Msg]) -> list[dict]
async
设置格式。
To support multi-agent conversations, this formatter processes messages as follows: - Prepends an instruction before the first conversation history section.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | list[Msg] | 消息列表(类型 `list[Msg]`)。The msgs. |
list[dict]
返回dict列表。`list[dict[str, Any]]`:
源码Source
agentscope/formatter/_dashscope_formatter.py:444–489