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

DashScopeChatFormatter

class DashScopeChatFormatter(_DashScopeFormatterBase)
源码Source agentscope/formatter/_dashscope_formatter.py:220–415

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

This formatter outputs messages in the OpenAI Chat Completions format, with DashScope-specific extensions for video (video_url) and thinking (reasoning_content).

方法摘要Method Summary

方法Method说明Description
async def format(msgs: list[Msg]) -> list[dict[str, Any]]async
设置格式。
Format message objects into DashScope OpenAI-compatible format.

方法详情Method Detail

format

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

设置格式。

Format message objects into DashScope OpenAI-compatible format.

参数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/_dashscope_formatter.py:231–415
基于官方固定版本源码静态生成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.