AS AgentScopeAPI 手册 / API Reference

AnthropicMultiAgentFormatter

public class AnthropicMultiAgentFormatter extends AnthropicBaseFormatter
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:48–227

Anthropic 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.

源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:62–64

AnthropicMultiAgentFormatter

public AnthropicMultiAgentFormatter(String conversationHistoryPrompt)

创建AnthropicMultiAgentFormatter 使用自定义会话历史提示词。

Create an AnthropicMultiAgentFormatter with custom conversation history prompt.

参数Parameters
名称Name类型Type说明Description
conversationHistoryPromptString会话历史提示词(类型 `String`)。The prompt to prepend before conversation history
源码Source 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.

参数Parameters
名称Name类型Type说明Description
msgsList<Msg>消息列表(类型 `List`)。The msgs.
返回Returns List<MessageParam>
返回列出。Returns list.
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:76–96

parseResponse

public ChatResponse parseResponse(Object response, Instant startTime)

解析响应。

Parses the response.

参数Parameters
名称Name类型Type说明Description
responseObject响应(类型 `Object`)。The response.
startTimeInstant启动时间(类型 `Instant`)。The start time.
返回Returns ChatResponse
返回ChatResponse。Returns chat response.
源码Source io/agentscope/extensions/model/anthropic/formatter/AnthropicMultiAgentFormatter.java:98–105

继承成员Inherited Members

基于官方固定版本源码静态生成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.