@ai-sdk/deepseek 3.0.79 → 3.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/index.js +91 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +90 -7
- package/dist/internal/index.js.map +1 -1
- package/docs/30-deepseek.mdx +4 -0
- package/package.json +3 -3
- package/src/chat/deepseek-chat-language-model.ts +21 -19
- package/src/chat/is-deepseek-v4-model.ts +4 -3
- package/src/deepseek-model-catalog.ts +169 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/deepseek
|
|
2
2
|
|
|
3
|
+
## 3.0.80
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7139593: Centralize DeepSeek model capabilities and endpoint policies in a shared catalog, preserving request behavior and generating the model capability table from the catalog.
|
|
8
|
+
|
|
9
|
+
Preserve unspecified strict-tool support for endpoints such as Azure, allowing strict tools through while retaining explicit endpoint restrictions.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [36802d4]
|
|
12
|
+
- Updated dependencies [e0143b0]
|
|
13
|
+
- Updated dependencies [934100c]
|
|
14
|
+
- Updated dependencies [892af4d]
|
|
15
|
+
- Updated dependencies [89aff56]
|
|
16
|
+
- Updated dependencies [41465fd]
|
|
17
|
+
- Updated dependencies [9754014]
|
|
18
|
+
- Updated dependencies [4bb73b0]
|
|
19
|
+
- Updated dependencies [2e44144]
|
|
20
|
+
- @ai-sdk/provider@4.0.36
|
|
21
|
+
- @ai-sdk/provider-utils@5.0.75
|
|
22
|
+
|
|
3
23
|
## 3.0.79
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,88 @@ function getDeepseekAssistantMessageOptionsSchema() {
|
|
|
106
106
|
}
|
|
107
107
|
const deepseekAssistantMessageProviderOptions = lazySchema(() => zodSchema(getDeepseekAssistantMessageOptionsSchema()));
|
|
108
108
|
//#endregion
|
|
109
|
+
//#region src/deepseek-model-catalog.ts
|
|
110
|
+
const languageDefinitions = {
|
|
111
|
+
"deepseek-flash": false,
|
|
112
|
+
"deepseek-v4-flash": false,
|
|
113
|
+
"deepseek-v4-pro": false,
|
|
114
|
+
"deepseek-v4-flash-vision-exp": true
|
|
115
|
+
};
|
|
116
|
+
function createLanguageModelEntry(modelId, image) {
|
|
117
|
+
const assistantHistory = !/(^|[/.])deepseek-(?:chat|reasoner|v[1-3](?:\.\d+)?)(?=[-/:.]|$)/.test(modelId);
|
|
118
|
+
const support = image != null ? true : "unknown";
|
|
119
|
+
const language = {
|
|
120
|
+
textGeneration: support,
|
|
121
|
+
inputs: {
|
|
122
|
+
image: image ?? "unknown",
|
|
123
|
+
audio: false
|
|
124
|
+
},
|
|
125
|
+
objectGeneration: support,
|
|
126
|
+
tools: {
|
|
127
|
+
usage: support,
|
|
128
|
+
streaming: support,
|
|
129
|
+
strict: "unknown"
|
|
130
|
+
},
|
|
131
|
+
reasoning: {
|
|
132
|
+
support,
|
|
133
|
+
...image != null ? { efforts: [
|
|
134
|
+
"low",
|
|
135
|
+
"high",
|
|
136
|
+
"max"
|
|
137
|
+
] } : {},
|
|
138
|
+
configurable: true,
|
|
139
|
+
enabledByDefault: modelId === "deepseek-reasoner" || assistantHistory,
|
|
140
|
+
assistantHistory
|
|
141
|
+
},
|
|
142
|
+
sampling: {
|
|
143
|
+
temperature: { condition: "Only effective when thinking is disabled." },
|
|
144
|
+
topP: { condition: "Only effective when thinking is disabled." },
|
|
145
|
+
logprobs: support,
|
|
146
|
+
penalties: false,
|
|
147
|
+
topK: false,
|
|
148
|
+
seed: false
|
|
149
|
+
},
|
|
150
|
+
structuredOutput: { jsonSchema: false },
|
|
151
|
+
endpoints: { assistantPrefixCompletion: false }
|
|
152
|
+
};
|
|
153
|
+
return {
|
|
154
|
+
capabilities: { language },
|
|
155
|
+
providerOptions: { language: {
|
|
156
|
+
logprobs: language.sampling.logprobs,
|
|
157
|
+
topLogprobs: language.sampling.logprobs,
|
|
158
|
+
userId: support,
|
|
159
|
+
thinking: language.reasoning.support,
|
|
160
|
+
reasoningEffort: language.reasoning.support,
|
|
161
|
+
strictJsonSchema: { condition: "Requires a serving endpoint with JSON schema response formatting." }
|
|
162
|
+
} }
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const deepseekModelCatalog = Object.fromEntries(Object.entries(languageDefinitions).map(([modelId, image]) => [modelId, createLanguageModelEntry(modelId, image)]));
|
|
166
|
+
function getDeepSeekLanguageModelEntry(modelId, endpoint = {}) {
|
|
167
|
+
const entry = Object.prototype.hasOwnProperty.call(deepseekModelCatalog, modelId) ? deepseekModelCatalog[modelId] : createLanguageModelEntry(modelId);
|
|
168
|
+
const { language } = entry.capabilities;
|
|
169
|
+
return {
|
|
170
|
+
...entry,
|
|
171
|
+
capabilities: { language: {
|
|
172
|
+
...language,
|
|
173
|
+
tools: {
|
|
174
|
+
...language.tools,
|
|
175
|
+
strict: endpoint.supportsStrictToolCalls ?? "unknown"
|
|
176
|
+
},
|
|
177
|
+
reasoning: {
|
|
178
|
+
...language.reasoning,
|
|
179
|
+
configurable: endpoint.supportsThinking !== false
|
|
180
|
+
},
|
|
181
|
+
sampling: {
|
|
182
|
+
...language.sampling,
|
|
183
|
+
penalties: endpoint.supportsPenaltySampling === true
|
|
184
|
+
},
|
|
185
|
+
structuredOutput: { jsonSchema: endpoint.supportsStructuredOutputs === true },
|
|
186
|
+
endpoints: { assistantPrefixCompletion: endpoint.supportsAssistantPrefixCompletion === true }
|
|
187
|
+
} }
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
109
191
|
//#region src/chat/is-deepseek-v4-model.ts
|
|
110
192
|
/**
|
|
111
193
|
* Whether a model id uses DeepSeek V4-or-newer behavior (thinking mode on by
|
|
@@ -117,7 +199,7 @@ const deepseekAssistantMessageProviderOptions = lazySchema(() => zodSchema(getDe
|
|
|
117
199
|
* their previous behavior; unrecognized IDs inherit the current protocol.
|
|
118
200
|
*/
|
|
119
201
|
function isDeepSeekV4Model(modelId) {
|
|
120
|
-
return
|
|
202
|
+
return getDeepSeekLanguageModelEntry(modelId).capabilities.language.reasoning.assistantHistory;
|
|
121
203
|
}
|
|
122
204
|
//#endregion
|
|
123
205
|
//#region src/chat/convert-to-deepseek-chat-messages.ts
|
|
@@ -731,14 +813,15 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
731
813
|
providerOptions,
|
|
732
814
|
schema: deepseekLanguageModelChatOptions
|
|
733
815
|
}) ?? {};
|
|
734
|
-
const
|
|
735
|
-
const
|
|
816
|
+
const { language: capabilities } = getDeepSeekLanguageModelEntry(this.modelId, this.config).capabilities;
|
|
817
|
+
const supportsStructuredOutputs = capabilities.structuredOutput.jsonSchema;
|
|
818
|
+
const supportsPenaltySampling = capabilities.sampling.penalties;
|
|
736
819
|
const { messages, warnings } = await convertToDeepSeekChatMessages({
|
|
737
820
|
prompt,
|
|
738
821
|
responseFormat,
|
|
739
822
|
modelId: this.modelId,
|
|
740
823
|
providerOptionsName: this.providerOptionsName,
|
|
741
|
-
supportsAssistantPrefixCompletion:
|
|
824
|
+
supportsAssistantPrefixCompletion: capabilities.endpoints.assistantPrefixCompletion,
|
|
742
825
|
supportsStructuredOutputs
|
|
743
826
|
});
|
|
744
827
|
const allWarnings = [...warnings];
|
|
@@ -763,7 +846,7 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
763
846
|
const { tools: deepseekTools, toolChoice: deepseekToolChoices, toolWarnings } = prepareTools({
|
|
764
847
|
tools,
|
|
765
848
|
toolChoice,
|
|
766
|
-
supportsStrictToolCalls:
|
|
849
|
+
supportsStrictToolCalls: capabilities.tools.strict === "unknown" ? void 0 : capabilities.tools.strict
|
|
767
850
|
});
|
|
768
851
|
const thinkingType = deepseekOptions.thinking?.type;
|
|
769
852
|
if (thinkingType === "adaptive") allWarnings.push({
|
|
@@ -771,8 +854,8 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
771
854
|
feature: "thinking.type",
|
|
772
855
|
details: "thinking.type \"adaptive\" is not a canonical DeepSeek value. mapped to \"enabled\"."
|
|
773
856
|
});
|
|
774
|
-
const thinking =
|
|
775
|
-
const isThinkingEnabled =
|
|
857
|
+
const thinking = !capabilities.reasoning.configurable ? void 0 : thinkingType != null ? { type: thinkingType === "adaptive" ? "enabled" : thinkingType } : isCustomReasoning(reasoning) ? { type: reasoning === "none" ? "disabled" : "enabled" } : void 0;
|
|
858
|
+
const isThinkingEnabled = capabilities.reasoning.configurable && thinking?.type !== "disabled" && (thinking != null || capabilities.reasoning.enabledByDefault);
|
|
776
859
|
if (isThinkingEnabled && temperature != null) allWarnings.push({
|
|
777
860
|
type: "unsupported",
|
|
778
861
|
feature: "temperature",
|
|
@@ -1208,7 +1291,7 @@ function hasSupportedFilenameExtension(filename) {
|
|
|
1208
1291
|
}
|
|
1209
1292
|
//#endregion
|
|
1210
1293
|
//#region src/version.ts
|
|
1211
|
-
const VERSION = "3.0.
|
|
1294
|
+
const VERSION = "3.0.80";
|
|
1212
1295
|
//#endregion
|
|
1213
1296
|
//#region src/deepseek-provider.ts
|
|
1214
1297
|
function createDeepSeek(options = {}) {
|