类class
agentscope.formatterXAIMultiAgentFormatter
class XAIMultiAgentFormatter(FormatterBase)
源码Source
agentscope/formatter/_xai_formatter.py:358–484xAI Multi 智能体格式化器,在智能体、模型与前端之间传递结构化消息和事件。位于 agentscope.formatter 包,继承自 FormatterBase。核心成员包括 format。
Produces xai_sdk protobuf Message objects (same as
:class:XAIChatFormatter). Prior agent-to-agent messages are collapsed
into a single user message with <history></history> tags; the
images of those messages are appended to the same user message, and
tool call / result sequences are delegated to :class:XAIChatFormatter.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
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.') |
input_types | list[str] | 输入类型字段。 | Field(default=['text/plain', 'image/jpeg', 'image/png'], description='The supported input types. Defaults to ``["text/plain", "image/jpeg", "image/png"]``.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def format(msgs: list[Msg], **kwargs: Any) -> List[Any]async | 执行格式相关操作。 Convert a list of ``Msg`` objects to ``xai_sdk`` proto messages. |
属性详情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/_xai_formatter.py:371input_types
list[str] = Field(default=['text/plain', 'image/jpeg', 'image/png'], description='The supported input types. Defaults to ``["text/plain", "image/jpeg", "image/png"]``.')输入类型字段。声明为 list[str]。
The supported input types.
源码Source
agentscope/formatter/_xai_formatter.py:380方法详情Method Detail
format
async def format(msgs: list[Msg], **kwargs: Any) -> List[Any]
async
执行格式相关操作。
Conversation history (non-tool messages) is collapsed into a single user protobuf message containing tags, followed by the images of those messages.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | list[Msg] | 消息列表(类型 `list[Msg]`)。A list of `Msg` objects representing the conversation. |
kwargs | Any | 关键字参数(类型 `Any`)。The kwargs. |
List[Any]
返回任意列表。`list[Any]`:
源码Source
agentscope/formatter/_xai_formatter.py:388–452