DeepSeekFormatter
@Deprecated public class DeepSeekFormatter extends OpenAIChatFormatter
源码Source
io/agentscope/extensions/model/openai/formatter/DeepSeekFormatter.java:47–205DeepSeek 格式化器,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.openai.formatter 包,继承自 OpenAIChatFormatter。核心成员包括 doFormat、supportsStrict、DeepSeekFormatter。
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)
-
Does NOT support strict parameter in tool definitions
-
In thinking mode, reasoning_content is preserved for segments with tool calls
Usage:
`OpenAIChatModel.builder()
.formatter(new DeepSeekFormatter())
.modelName("deepseek-chat")
.baseUrl("https://api.deepseek.com/v1")
.apiKey(apiKey)
.build();
`
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public DeepSeekFormatter() | 初始化 `DeepSeekFormatter` 实例。 Creates a new instance. |
public DeepSeekFormatter(boolean appendEmptyUserIfEndsWithAssistant) | 初始化 `DeepSeekFormatter` 实例。 Create a DeepSeek formatter with optional empty user message appending. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
protected List<OpenAIMessage> doFormat(List<Msg> msgs) | 执行格式操作。 Performs the do format operation. |
protected boolean supportsStrict() | 返回 `supportsStrict` 结果。 Returns the supports strict. |
构造器详情Constructor Detail
DeepSeekFormatter
public DeepSeekFormatter()
初始化 DeepSeekFormatter 实例。
Creates a new instance.
源码Source
io/agentscope/extensions/model/openai/formatter/DeepSeekFormatter.java:52–54DeepSeekFormatter
public DeepSeekFormatter(boolean appendEmptyUserIfEndsWithAssistant)
初始化 DeepSeekFormatter 实例。
Create a DeepSeek formatter with optional empty user message appending.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
appendEmptyUserIfEndsWithAssistant | boolean | 追加 Empty 用户 If Ends 使用 Assistant(类型 `boolean`)。if true, append an empty user message when the conversation ends with an assistant message to avoid API errors |
源码Source
io/agentscope/extensions/model/openai/formatter/DeepSeekFormatter.java:62–65方法详情Method Detail
doFormat
protected List<OpenAIMessage> doFormat(List<Msg> msgs)
执行格式操作。
Performs the do format operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
List<OpenAIMessage>返回列出。Returns list.
源码Source
io/agentscope/extensions/model/openai/formatter/DeepSeekFormatter.java:67–75supportsStrict
protected boolean supportsStrict()
返回 supportsStrict 结果。
Returns the supports strict.
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/extensions/model/openai/formatter/DeepSeekFormatter.java:77–80