类 AnthropicChatFormatter

java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<com.anthropic.models.messages.MessageParam,Object,com.anthropic.models.messages.MessageCreateParams.Builder>
io.agentscope.core.formatter.anthropic.AnthropicBaseFormatter
io.agentscope.core.formatter.anthropic.AnthropicChatFormatter
所有已实现的接口:
Formatter<com.anthropic.models.messages.MessageParam,Object,com.anthropic.models.messages.MessageCreateParams.Builder>

public class AnthropicChatFormatter extends AnthropicBaseFormatter
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)
  • 构造器详细资料

    • AnthropicChatFormatter

      public AnthropicChatFormatter()
  • 方法详细资料

    • doFormat

      public List<com.anthropic.models.messages.MessageParam> doFormat(List<Msg> msgs)
      指定者:
      doFormat 在类中 AbstractBaseFormatter<com.anthropic.models.messages.MessageParam,Object,com.anthropic.models.messages.MessageCreateParams.Builder>
    • parseResponse

      public ChatResponse parseResponse(Object response, Instant startTime)
      从接口复制的说明: Formatter
      Parse provider-specific response to AgentScope ChatResponse.
      参数:
      response - Provider-specific response object
      startTime - Request start time for calculating duration
      返回:
      AgentScope ChatResponse