Class DeepSeekMultiAgentFormatter

All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>

public class DeepSeekMultiAgentFormatter extends OpenAIMultiAgentFormatter
Multi-agent formatter for DeepSeek Chat models (deepseek-v4-flash, deepseek-v4-pro).

This formatter extends OpenAIMultiAgentFormatter with DeepSeek-specific handling:

  • System/user/assistant name fields are allowed
  • Omits strict parameter in tool definitions
  • reasoning_content handling for thinking mode

Usage:


 OpenAIChatModel.builder()
     .formatter(new DeepSeekMultiAgentFormatter())
     .modelName("deepseek-v4-pro")
     .baseUrl("https://api.deepseek.com")
     .apiKey(apiKey)
     .build();
 
  • Constructor Details

    • DeepSeekMultiAgentFormatter

      public DeepSeekMultiAgentFormatter()
    • DeepSeekMultiAgentFormatter

      public DeepSeekMultiAgentFormatter(String conversationHistoryPrompt)
    • DeepSeekMultiAgentFormatter

      public DeepSeekMultiAgentFormatter(boolean appendEmptyUserIfEndsWithAssistant)
      Create a DeepSeek multi-agent formatter with optional empty user message appending.
      Parameters:
      appendEmptyUserIfEndsWithAssistant - if true, append an empty user message when the conversation ends with an assistant message to avoid API errors
    • DeepSeekMultiAgentFormatter

      public DeepSeekMultiAgentFormatter(String conversationHistoryPrompt, boolean appendEmptyUserIfEndsWithAssistant)
      Create a DeepSeek multi-agent formatter with custom conversation history prompt and optional empty user message appending.
      Parameters:
      conversationHistoryPrompt - custom prompt for conversation history
      appendEmptyUserIfEndsWithAssistant - if true, append an empty user message when the conversation ends with an assistant message to avoid API errors
  • Method Details

    • doFormat

      protected List<OpenAIMessage> doFormat(List<io.agentscope.core.message.Msg> msgs)
      Overrides:
      doFormat in class OpenAIMultiAgentFormatter
    • supportsStrict

      protected boolean supportsStrict()
      Description copied from class: OpenAIChatFormatter
      Returns whether this formatter's target API supports the strict parameter in tool definitions.

      Subclasses can override this method to disable strict parameter for providers that don't support it (e.g., DeepSeek).

      Overrides:
      supportsStrict in class OpenAIChatFormatter
      Returns:
      true if strict parameter is supported, false otherwise