Class AnthropicChatFormatter
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.AnthropicChatFormatter
- All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<com.anthropic.models.messages.MessageParam,Object, com.anthropic.models.messages.MessageCreateParams.Builder>
Formatter for Anthropic Messages API. Converts between AgentScope Msg objects and Anthropic SDK
types.
Important: Anthropic API has special requirements:
- Only the first message can be a system message (handled via system parameter)
- Tool results must be in separate user messages
- Supports thinking blocks natively (extended thinking feature)
-
Field Summary
Fields inherited from class io.agentscope.extensions.model.anthropic.formatter.AnthropicBaseFormatter
messageConverter -
Constructor Summary
Constructors -
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
-
AnthropicChatFormatter
public AnthropicChatFormatter()
-
-
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
-