类 DeepSeekMultiAgentFormatter

所有已实现的接口:
Formatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>

public class DeepSeekMultiAgentFormatter extends OpenAIMultiAgentFormatter
Multi-agent formatter for DeepSeek Chat models.

This formatter extends OpenAIMultiAgentFormatter with DeepSeek-specific handling:

  • No name field in messages (returns HTTP 400 if present)
  • System messages converted to user messages
  • Does NOT support strict parameter in tool definitions
  • reasoning_content handling for thinking mode

Usage:


 OpenAIChatModel.builder()
     .formatter(new DeepSeekMultiAgentFormatter())
     .modelName("deepseek-chat")
     .baseUrl("https://api.deepseek.com/v1")
     .apiKey(apiKey)
     .build();
 
  • 构造器详细资料

    • 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.
      参数:
      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.
      参数:
      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
  • 方法详细资料

    • doFormat

      protected List<OpenAIMessage> doFormat(List<Msg> msgs)
      覆盖:
      doFormat 在类中 OpenAIMultiAgentFormatter
    • supportsStrict

      protected boolean supportsStrict()
      从类复制的说明: 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).

      覆盖:
      supportsStrict 在类中 OpenAIChatFormatter
      返回:
      true if strict parameter is supported, false otherwise