AnthropicMultiAgentFormatter
public class AnthropicMultiAgentFormatter extends AnthropicBaseFormatter
io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:48–227Anthropic Multi 智能体格式化器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.anthropic.formatter 包,继承自 AnthropicBaseFormatter。核心成员包括 doFormat、parseResponse、AnthropicMultiAgentFormatter。
Multi-agent formatter for Anthropic Messages API. Converts AgentScope Msg objects to Anthropic SDK MessageParam objects with multi-agent support.
This formatter handles conversations between multiple agents by:
-
Grouping multi-agent messages into conversation history
-
Using special markup (history tags) to structure conversations
-
Consolidating multi-agent conversations into single user messages
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AnthropicMultiAgentFormatter() | 创建AnthropicMultiAgentFormatter 使用默认会话历史提示词。 Create an AnthropicMultiAgentFormatter with default conversation history prompt. |
public AnthropicMultiAgentFormatter(String conversationHistoryPrompt) | 创建AnthropicMultiAgentFormatter 使用自定义会话历史提示词。 Create an AnthropicMultiAgentFormatter with custom conversation history prompt. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public List<MessageParam> doFormat(List<Msg> msgs) | 执行格式操作。 Performs the do format operation. |
public ChatResponse parseResponse(Object response, Instant startTime) | 解析响应。 Parses the response. |
构造器详情Constructor Detail
AnthropicMultiAgentFormatter
public AnthropicMultiAgentFormatter()
创建AnthropicMultiAgentFormatter 使用默认会话历史提示词。
Create an AnthropicMultiAgentFormatter with default conversation history prompt.
io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:62–64AnthropicMultiAgentFormatter
public AnthropicMultiAgentFormatter(String conversationHistoryPrompt)
创建AnthropicMultiAgentFormatter 使用自定义会话历史提示词。
Create an AnthropicMultiAgentFormatter with custom conversation history prompt.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
conversationHistoryPrompt | String | 会话历史提示词(类型 `String`)。The prompt to prepend before conversation history |
io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:71–74方法详情Method Detail
doFormat
public List<MessageParam> doFormat(List<Msg> msgs)
执行格式操作。
Performs the do format operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
List<MessageParam>io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:76–96parseResponse
public ChatResponse parseResponse(Object response, Instant startTime)
解析响应。
Parses the response.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
response | Object | 响应(类型 `Object`)。The response. |
startTime | Instant | 启动时间(类型 `Instant`)。The start time. |
ChatResponseio/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:98–105