Class AnthropicMultiAgentFormatter
java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<com.anthropic.models.messages.MessageParam,Object,com.anthropic.models.messages.MessageCreateParams.Builder>
io.agentscope.extensions.model.anthropic.formatter.AnthropicBaseFormatter
io.agentscope.extensions.model.anthropic.formatter.AnthropicMultiAgentFormatter
- All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<com.anthropic.models.messages.MessageParam,Object, com.anthropic.models.messages.MessageCreateParams.Builder>
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
-
Field Summary
Fields inherited from class io.agentscope.extensions.model.anthropic.formatter.AnthropicBaseFormatter
messageConverter -
Constructor Summary
ConstructorsConstructorDescriptionCreate an AnthropicMultiAgentFormatter with default conversation history prompt.AnthropicMultiAgentFormatter(String conversationHistoryPrompt) Create an AnthropicMultiAgentFormatter with custom conversation history prompt. -
Method Summary
Methods inherited from class io.agentscope.extensions.model.anthropic.formatter.AnthropicBaseFormatter
applyCacheControl, applyOptions, applySystemMessage, applySystemMessage, applyTools, cacheTtlMethods inherited from class io.agentscope.core.formatter.AbstractBaseFormatter
convertToolResultToString, doFormat, extractTextContent, extractTextContent, format, format, formatRoleLabel, getOptionOrDefault, hasMediaContent, saveBase64DataToTempFile, shouldBypassHistoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.core.formatter.Formatter
applyToolChoice, applyToolChoice, applyTools
-
Constructor Details
-
AnthropicMultiAgentFormatter
public AnthropicMultiAgentFormatter()Create an AnthropicMultiAgentFormatter with default conversation history prompt. -
AnthropicMultiAgentFormatter
Create an AnthropicMultiAgentFormatter with custom conversation history prompt.- Parameters:
conversationHistoryPrompt- The prompt to prepend before conversation history
-
-
Method Details
-
doFormat
public List<com.anthropic.models.messages.MessageParam> doFormat(List<io.agentscope.core.message.Msg> msgs) - Specified by:
doFormatin classio.agentscope.core.formatter.AbstractBaseFormatter<com.anthropic.models.messages.MessageParam,Object, com.anthropic.models.messages.MessageCreateParams.Builder>
-
parseResponse
-