类 DeepSeekFormatter
java.lang.Object
io.agentscope.core.formatter.AbstractBaseFormatter<OpenAIMessage,OpenAIResponse,OpenAIRequest>
io.agentscope.core.formatter.openai.OpenAIBaseFormatter
io.agentscope.core.formatter.openai.OpenAIChatFormatter
io.agentscope.core.formatter.openai.DeepSeekFormatter
- 所有已实现的接口:
Formatter<OpenAIMessage,OpenAIResponse, OpenAIRequest>
Formatter for DeepSeek Chat models (deepseek-chat, deepseek-coder).
DeepSeek API has the following specific requirements:
- No name field in messages (returns HTTP 400 if present)
- System messages should be converted to user messages
- Does NOT support strict parameter in tool definitions
- reasoning_content must be kept within current turn but removed for previous turns
Usage:
OpenAIChatModel.builder()
.formatter(new DeepSeekFormatter())
.modelName("deepseek-chat")
.baseUrl("https://api.deepseek.com/v1")
.apiKey(apiKey)
.build();
- 另请参阅:
-
字段概要
从类继承的字段 io.agentscope.core.formatter.openai.OpenAIBaseFormatter
messageConverter, responseParser -
构造器概要
构造器构造器说明DeepSeekFormatter(boolean appendEmptyUserIfEndsWithAssistant) Create a DeepSeek formatter with optional empty user message appending. -
方法概要
修饰符和类型方法说明protected List<OpenAIMessage> protected booleanReturns whether this formatter's target API supports the strict parameter in tool definitions.从类继承的方法 io.agentscope.core.formatter.openai.OpenAIChatFormatter
applyAdditionalBodyParams, applyMaxTokens, applyOptions, applyToolChoice, applyTools从类继承的方法 io.agentscope.core.formatter.openai.OpenAIBaseFormatter
applyCacheControl, applyToolChoice, applyTools, buildRequest, buildRequest, parseResponse从类继承的方法 io.agentscope.core.formatter.AbstractBaseFormatter
convertToolResultToString, extractTextContent, extractTextContent, format, formatRoleLabel, getOptionOrDefault, hasMediaContent, saveBase64DataToTempFile, shouldBypassHistory
-
构造器详细资料
-
DeepSeekFormatter
public DeepSeekFormatter() -
DeepSeekFormatter
public DeepSeekFormatter(boolean appendEmptyUserIfEndsWithAssistant) Create a DeepSeek 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
-
-
方法详细资料
-
doFormat
- 覆盖:
doFormat在类中OpenAIChatFormatter
-
supportsStrict
protected boolean supportsStrict()从类复制的说明: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).
- 覆盖:
supportsStrict在类中OpenAIChatFormatter- 返回:
- true if strict parameter is supported, false otherwise
-