类class
agentscope.formatterGeminiMultiAgentFormatter
class GeminiMultiAgentFormatter(_GeminiFormatterBase)
源码Source
agentscope/formatter/_gemini_formatter.py:332–492Gemini Multi 智能体格式化器,在智能体、模型与前端之间传递结构化消息和事件。位于 agentscope.formatter 包,继承自 _GeminiFormatterBase。核心成员包括 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(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_factory=lambda: ['text/plain', 'image/*', 'audio/*', 'video/*', 'application/pdf'], description='The supported input types. Defaults to ``["text/plain", "image/*", "audio/*", "video/*", "application/pdf"]``.') |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
async def format(msgs: list[Msg]) -> list[dict[str, Any]]async | 设置格式。 Format input messages into the structure required by the Gemini API 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/_gemini_formatter.py:351input_types
list[str] = Field(default_factory=lambda: ['text/plain', 'image/*', 'audio/*', 'video/*', 'application/pdf'], description='The supported input types. Defaults to ``["text/plain", "image/*", "audio/*", "video/*", "application/pdf"]``.')输入类型字段。声明为 list[str]。
The supported input types.
源码Source
agentscope/formatter/_gemini_formatter.py:360方法详情Method Detail
format
async def format(msgs: list[Msg]) -> list[dict[str, Any]]
async
设置格式。
Format input messages into the structure required by the Gemini API for multi-agent conversations.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | list[Msg] | 消息列表(类型 `list[Msg]`)。The msgs. |
list[dict[str, Any]]
返回dict[str,任意]列表。Returns a list of dict str any.
源码Source
agentscope/formatter/_gemini_formatter.py:374–403