@ai-sdk/deepseek 3.0.79 → 3.0.81

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 CHANGED
@@ -1,5 +1,36 @@
1
1
  # @ai-sdk/deepseek
2
2
 
3
+ ## 3.0.81
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6400cf8]
8
+ - Updated dependencies [f608c05]
9
+ - Updated dependencies [cab9c1f]
10
+ - Updated dependencies [c70adf6]
11
+ - @ai-sdk/provider-utils@5.0.76
12
+ - @ai-sdk/provider@4.0.37
13
+
14
+ ## 3.0.80
15
+
16
+ ### Patch Changes
17
+
18
+ - 7139593: Centralize DeepSeek model capabilities and endpoint policies in a shared catalog, preserving request behavior and generating the model capability table from the catalog.
19
+
20
+ Preserve unspecified strict-tool support for endpoints such as Azure, allowing strict tools through while retaining explicit endpoint restrictions.
21
+
22
+ - Updated dependencies [36802d4]
23
+ - Updated dependencies [e0143b0]
24
+ - Updated dependencies [934100c]
25
+ - Updated dependencies [892af4d]
26
+ - Updated dependencies [89aff56]
27
+ - Updated dependencies [41465fd]
28
+ - Updated dependencies [9754014]
29
+ - Updated dependencies [4bb73b0]
30
+ - Updated dependencies [2e44144]
31
+ - @ai-sdk/provider@4.0.36
32
+ - @ai-sdk/provider-utils@5.0.75
33
+
3
34
  ## 3.0.79
4
35
 
5
36
  ### 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 !/(^|[/.])deepseek-(?:chat|reasoner|v[1-3](?:\.\d+)?)(?=[-/:.]|$)/.test(modelId);
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 supportsStructuredOutputs = this.config.supportsStructuredOutputs === true;
735
- const supportsPenaltySampling = this.config.supportsPenaltySampling === true;
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: this.config.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: this.config.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 = this.config.supportsThinking === false ? void 0 : thinkingType != null ? { type: thinkingType === "adaptive" ? "enabled" : thinkingType } : isCustomReasoning(reasoning) ? { type: reasoning === "none" ? "disabled" : "enabled" } : void 0;
775
- const isThinkingEnabled = this.config.supportsThinking !== false && thinking?.type !== "disabled" && (thinking != null || this.modelId === "deepseek-reasoner" || isDeepSeekV4Model(this.modelId));
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.79";
1294
+ const VERSION = "3.0.81";
1212
1295
  //#endregion
1213
1296
  //#region src/deepseek-provider.ts
1214
1297
  function createDeepSeek(options = {}) {