@ai-sdk/deepseek 3.0.75 → 3.0.77
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 +31 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -11
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +3 -6
- package/dist/internal/index.js.map +1 -1
- package/docs/30-deepseek.mdx +5 -6
- package/package.json +3 -3
- package/src/chat/deepseek-chat-language-model.ts +12 -11
- package/src/deepseek-provider.ts +16 -11
- package/src/files/deepseek-files.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @ai-sdk/deepseek
|
|
2
2
|
|
|
3
|
+
## 3.0.77
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7716e18: Support promises and synchronous or asynchronous callbacks in provider API key and token settings. Resolve credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.
|
|
8
|
+
|
|
9
|
+
The experimental OpenAI Live `getServerWebSocketConfig()` method can now resolve asynchronously. Await its result before using the connection settings.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [7716e18]
|
|
12
|
+
- Updated dependencies [5c247e9]
|
|
13
|
+
- Updated dependencies [dcd2f8d]
|
|
14
|
+
- @ai-sdk/provider-utils@5.0.72
|
|
15
|
+
- @ai-sdk/provider@4.0.35
|
|
16
|
+
|
|
17
|
+
## 3.0.76
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 61a315e: fix: map the top-level `reasoning` option consistently across providers
|
|
22
|
+
|
|
23
|
+
Providers now resolve reasoning the same way:
|
|
24
|
+
|
|
25
|
+
1. A provider-specific reasoning setting in `providerOptions` is sent unchanged. OpenAI no longer drops `providerOptions.openai.reasoningEffort` values that are not in its list for the model, and Fireworks no longer rewrites `providerOptions.fireworks.reasoningEffort`. Fireworks also sends top-level `reasoning` values directly instead of rounding them to `'high'` at most, except for model families known to reject `'none'` (GPT-OSS, GLM-5.3, Muse Spark) or `'minimal'` (Nemotron, Inkling).
|
|
26
|
+
2. Otherwise, `reasoning` maps to the closest level the model supports, rounding down, and rounds up only when there is no lower level. For example, `'xhigh'` now maps to `'high'` instead of `'max'` on Anthropic and Bedrock models without `xhigh` effort, and `'medium'` maps to `'low'` instead of `'high'` on DeepSeek, Kimi K3, and Mistral GLM-5.3 models.
|
|
27
|
+
3. `'none'` on a model that cannot disable reasoning maps to the model's lowest level with a compatibility warning, instead of being dropped or sending a request the API rejects. This affects GPT-6 models without `'none'`, xAI grok-4.5 and later, Groq GPT-OSS, Kimi K3, Perplexity, QuiverAI, Bedrock OpenAI `gpt-oss` models, and Gemini 2.5 Pro (minimum thinking budget). Gemini 3 and Anthropic and Bedrock `between_tools` mappings now emit the compatibility warning too.
|
|
28
|
+
|
|
29
|
+
`mapReasoningToProviderEffort` now accepts any `reasoning` value, returns an optional `providerOptionsEffort` unchanged, and rounds levels that are missing from the effort map to the closest supported level. `mapReasoningToProviderBudget` maps `'none'` to the minimum reasoning budget, always returns a budget, and uses the default percentage for levels missing from `budgetPercentages`. `OpenAICompatibleChatConfig` adds an optional `mapReasoning` function for mapping the top-level `reasoning` option.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [61a315e]
|
|
32
|
+
- @ai-sdk/provider-utils@5.0.71
|
|
33
|
+
|
|
3
34
|
## 3.0.75
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FilesV4, LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
-
import { FetchFunction, InferSchema } from "@ai-sdk/provider-utils";
|
|
2
|
+
import { FetchFunction, InferSchema, Resolvable } from "@ai-sdk/provider-utils";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
4
|
//#region src/chat/deepseek-chat-language-model-options.d.ts
|
|
5
5
|
type DeepSeekChatModelId = 'deepseek-flash' | 'deepseek-v4-flash' | 'deepseek-v4-pro' | 'deepseek-v4-flash-vision-exp' | (string & {});
|
|
@@ -53,8 +53,9 @@ type DeepSeekAssistantMessageProviderOptions = InferSchema<typeof deepseekAssist
|
|
|
53
53
|
interface DeepSeekProviderSettings {
|
|
54
54
|
/**
|
|
55
55
|
* DeepSeek API key.
|
|
56
|
+
* A function is called before each request and may return a promise.
|
|
56
57
|
*/
|
|
57
|
-
apiKey?: string
|
|
58
|
+
apiKey?: Resolvable<string>;
|
|
58
59
|
/**
|
|
59
60
|
* Base URL for the API calls.
|
|
60
61
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/chat/deepseek-chat-language-model-options.ts","../src/deepseek-provider.ts","../src/version.ts","../src/chat/deepseek-chat-api-types.ts","../src/chat/deepseek-file-part-options.ts","../src/files/deepseek-files-options.ts"],"mappings":";;;;KAQY;KA+EA;;;;EAIV;;;;;;EAOA;;;;;;;;EASA;;;;EAKA;IACE;;;;;EAMF;;;;;;EAOA;;cAsBW,iEAA8B;EAAA;;KAI/B,iCAAiC,mBACpC;cAuBI,0EAAuC;;;;KAIxC,0CAA0C,mBAC7C;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/chat/deepseek-chat-language-model-options.ts","../src/deepseek-provider.ts","../src/version.ts","../src/chat/deepseek-chat-api-types.ts","../src/chat/deepseek-file-part-options.ts","../src/files/deepseek-files-options.ts"],"mappings":";;;;KAQY;KA+EA;;;;EAIV;;;;;;EAOA;;;;;;;;EASA;;;;EAKA;IACE;;;;;EAMF;;;;;;EAOA;;cAsBW,iEAA8B;EAAA;;KAI/B,iCAAiC,mBACpC;cAuBI,0EAAuC;;;;KAIxC,0CAA0C,mBAC7C;;;UClKQ;;;;;EAKf,SAAS;;;;EAKT;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;UAGO,yBAAyB;;;;GAIvC,SAAS,sBAAsB;;;;EAKhC,cAAc,SAAS,sBAAsB;;;;EAK7C,KAAK,SAAS,sBAAsB;;;;EAKpC,SAAS;;;;EAKT,mBAAmB;;wBAGL,eACd,UAAS,2BACR;qBA0DU,UAAQ;;;qBChIR;;;cCiJA,sDAAmB;;;;;;;;KAIpB,oBAAoB,mBAAmB;;;cChJtC,kEAA+B;;;;KAuBhC,kCAAkC,mBACrC;;;cCxBI,6DAA0B;EAAA;;KAY3B,uBAAuB,mBAC1B"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, NoSuchModelError, UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
|
-
import { StreamingToolCallTracker, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, convertInlineFileDataToUint8Array, convertToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createLanguageModelResponseMetadata as getResponseMetadata, createNullLanguageModelUsage, createProviderStreamError, detectMediaType, generateId, getTopLevelMediaType, isCustomReasoning, lazySchema, loadApiKey, mapReasoningToProviderEffort, parseProviderOptions, postFormDataToApi, postJsonToApi, resolveFullMediaType, resolveProviderReference, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
|
+
import { StreamingToolCallTracker, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, convertInlineFileDataToUint8Array, convertToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createLanguageModelResponseMetadata as getResponseMetadata, createNullLanguageModelUsage, createProviderStreamError, detectMediaType, generateId, getTopLevelMediaType, isCustomReasoning, lazySchema, loadApiKey, mapReasoningToProviderEffort, parseProviderOptions, postFormDataToApi, postJsonToApi, resolve, resolveFullMediaType, resolveProviderReference, resolveWith, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
4
|
//#region src/chat/deepseek-file-part-options.ts
|
|
5
5
|
const deepseekFilePartProviderOptions = lazySchema(() => zodSchema(z.object({
|
|
@@ -780,11 +780,8 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
780
780
|
}) : isCustomReasoning(reasoning) && reasoning !== "none" ? mapReasoningToProviderEffort({
|
|
781
781
|
reasoning,
|
|
782
782
|
effortMap: {
|
|
783
|
-
minimal: "low",
|
|
784
783
|
low: "low",
|
|
785
|
-
medium: "high",
|
|
786
784
|
high: "high",
|
|
787
|
-
xhigh: "max",
|
|
788
785
|
max: "max"
|
|
789
786
|
},
|
|
790
787
|
warnings: allWarnings
|
|
@@ -826,7 +823,7 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
826
823
|
path: "/chat/completions",
|
|
827
824
|
modelId: this.modelId
|
|
828
825
|
}),
|
|
829
|
-
headers: combineHeaders(this.config.headers
|
|
826
|
+
headers: combineHeaders(await resolve(this.config.headers), options.headers),
|
|
830
827
|
body: args,
|
|
831
828
|
failedResponseHandler: this.failedResponseHandler,
|
|
832
829
|
successfulResponseHandler: createJsonResponseHandler(deepseekChatResponseSchema),
|
|
@@ -893,7 +890,7 @@ var DeepSeekChatLanguageModel = class DeepSeekChatLanguageModel {
|
|
|
893
890
|
path: "/chat/completions",
|
|
894
891
|
modelId: this.modelId
|
|
895
892
|
}),
|
|
896
|
-
headers: combineHeaders(this.config.headers
|
|
893
|
+
headers: combineHeaders(await resolve(this.config.headers), options.headers),
|
|
897
894
|
body,
|
|
898
895
|
failedResponseHandler: this.failedResponseHandler,
|
|
899
896
|
successfulResponseHandler: createEventSourceResponseHandler(deepseekChatChunkSchema),
|
|
@@ -1140,7 +1137,7 @@ var DeepSeekFiles = class {
|
|
|
1140
1137
|
}
|
|
1141
1138
|
const { value: response } = await postFormDataToApi({
|
|
1142
1139
|
url: `${this.config.baseURL}/files`,
|
|
1143
|
-
headers: combineHeaders(this.config.headers
|
|
1140
|
+
headers: combineHeaders(await resolve(this.config.headers), headers),
|
|
1144
1141
|
formData,
|
|
1145
1142
|
failedResponseHandler: deepSeekFailedResponseHandler,
|
|
1146
1143
|
successfulResponseHandler: createJsonResponseHandler(deepSeekFilesResponseSchema),
|
|
@@ -1202,19 +1199,19 @@ function hasSupportedFilenameExtension(filename) {
|
|
|
1202
1199
|
}
|
|
1203
1200
|
//#endregion
|
|
1204
1201
|
//#region src/version.ts
|
|
1205
|
-
const VERSION = "3.0.
|
|
1202
|
+
const VERSION = "3.0.77";
|
|
1206
1203
|
//#endregion
|
|
1207
1204
|
//#region src/deepseek-provider.ts
|
|
1208
1205
|
function createDeepSeek(options = {}) {
|
|
1209
1206
|
const baseURL = withoutTrailingSlash(options.baseURL ?? "https://api.deepseek.com") ?? "https://api.deepseek.com";
|
|
1210
|
-
const getHeaders = () => withUserAgentSuffix({
|
|
1207
|
+
const getHeaders = () => resolveWith(options.apiKey, (apiKey) => withUserAgentSuffix({
|
|
1211
1208
|
Authorization: `Bearer ${loadApiKey({
|
|
1212
|
-
apiKey
|
|
1209
|
+
apiKey,
|
|
1213
1210
|
environmentVariableName: "DEEPSEEK_API_KEY",
|
|
1214
1211
|
description: "DeepSeek API key"
|
|
1215
1212
|
})}`,
|
|
1216
1213
|
...options.headers
|
|
1217
|
-
}, `ai-sdk-deepseek/${VERSION}`);
|
|
1214
|
+
}, `ai-sdk-deepseek/${VERSION}`));
|
|
1218
1215
|
const createLanguageModel = (modelId) => {
|
|
1219
1216
|
return new DeepSeekChatLanguageModel(modelId, {
|
|
1220
1217
|
provider: `deepseek.chat`,
|