Class DeepSeekMultiAgentFormatter
java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
io.agentscope.extensions.model.openai.formatter.OpenAIChatFormatter
io.agentscope.extensions.model.openai.formatter.OpenAIMultiAgentFormatter
io.agentscope.extensions.model.openai.compat.deepseek.DeepSeekMultiAgentFormatter
- All Implemented Interfaces:
io.agentscope.core.formatter.Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest>
Multi-agent formatter for DeepSeek Chat models (deepseek-v4-flash, deepseek-v4-pro).
This formatter extends OpenAIMultiAgentFormatter with DeepSeek-specific handling:
- System/user/assistant
namefields 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();
-
Field Summary
Fields inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
messageConverter, responseParser -
Constructor Summary
ConstructorsConstructorDescriptionDeepSeekMultiAgentFormatter(boolean appendEmptyUserIfEndsWithAssistant) Create a DeepSeek multi-agent formatter with optional empty user message appending.DeepSeekMultiAgentFormatter(String conversationHistoryPrompt) DeepSeekMultiAgentFormatter(String conversationHistoryPrompt, boolean appendEmptyUserIfEndsWithAssistant) Create a DeepSeek multi-agent formatter with custom conversation history prompt and optional empty user message appending. -
Method Summary
Modifier and TypeMethodDescriptionprotected List<OpenAIMessage>protected booleanReturns whether this formatter's target API supports the strict parameter in tool definitions.Methods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIMultiAgentFormatter
doFormatMethods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIChatFormatter
applyAdditionalBodyParams, applyMaxTokens, applyOptions, applyToolChoice, applyTools, convertMessageMethods inherited from class io.agentscope.extensions.model.openai.formatter.OpenAIBaseFormatter
applyToolChoice, applyTools, buildRequest, buildRequest, parseResponseMethods inherited from class io.agentscope.core.formatter.AbstractBaseFormatter
convertToolResultToString, extractTextContent, extractTextContent, format, format, formatRoleLabel, getOptionOrDefault, hasMediaContent, saveBase64DataToTempFile, shouldBypassHistory
-
Constructor Details
-
DeepSeekMultiAgentFormatter
public DeepSeekMultiAgentFormatter() -
DeepSeekMultiAgentFormatter
-
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 historyappendEmptyUserIfEndsWithAssistant- if true, append an empty user message when the conversation ends with an assistant message to avoid API errors
-
-
Method Details
-
doFormat
- Overrides:
doFormatin classOpenAIMultiAgentFormatter
-
supportsStrict
protected boolean supportsStrict()Description copied from class:OpenAIChatFormatterReturns 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:
supportsStrictin classOpenAIChatFormatter- Returns:
- true if strict parameter is supported, false otherwise
-