@ai-sdk/deepseek 3.0.0-beta.21 → 3.0.0-beta.23
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 +29 -0
- package/dist/index.js +128 -126
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/chat/deepseek-chat-language-model.ts +20 -3
- package/dist/index.d.mts +0 -68
- package/dist/index.mjs +0 -821
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @ai-sdk/deepseek
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
8
|
+
|
|
9
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
10
|
+
|
|
11
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
12
|
+
|
|
13
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [b3976a2]
|
|
16
|
+
- Updated dependencies [ff5eba1]
|
|
17
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
18
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
19
|
+
|
|
20
|
+
## 3.0.0-beta.22
|
|
21
|
+
|
|
22
|
+
### Major Changes
|
|
23
|
+
|
|
24
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [ef992f8]
|
|
29
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
30
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
31
|
+
|
|
3
32
|
## 3.0.0-beta.21
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
createDeepSeek: () => createDeepSeek,
|
|
25
|
-
deepseek: () => deepseek
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/deepseek-provider.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withoutTrailingSlash,
|
|
8
|
+
withUserAgentSuffix
|
|
9
|
+
} from "@ai-sdk/provider-utils";
|
|
32
10
|
|
|
33
11
|
// src/chat/deepseek-chat-language-model.ts
|
|
34
|
-
|
|
35
|
-
|
|
12
|
+
import {
|
|
13
|
+
InvalidResponseDataError
|
|
14
|
+
} from "@ai-sdk/provider";
|
|
15
|
+
import {
|
|
16
|
+
combineHeaders,
|
|
17
|
+
createEventSourceResponseHandler,
|
|
18
|
+
createJsonErrorResponseHandler,
|
|
19
|
+
createJsonResponseHandler,
|
|
20
|
+
generateId,
|
|
21
|
+
isCustomReasoning,
|
|
22
|
+
isParsableJson,
|
|
23
|
+
parseProviderOptions,
|
|
24
|
+
postJsonToApi,
|
|
25
|
+
serializeModelOptions,
|
|
26
|
+
WORKFLOW_SERIALIZE,
|
|
27
|
+
WORKFLOW_DESERIALIZE
|
|
28
|
+
} from "@ai-sdk/provider-utils";
|
|
36
29
|
|
|
37
30
|
// src/chat/convert-to-deepseek-chat-messages.ts
|
|
38
31
|
function convertToDeepSeekChatMessages({
|
|
@@ -216,76 +209,76 @@ function convertDeepSeekUsage(usage) {
|
|
|
216
209
|
}
|
|
217
210
|
|
|
218
211
|
// src/chat/deepseek-chat-api-types.ts
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
var tokenUsageSchema =
|
|
222
|
-
prompt_tokens:
|
|
223
|
-
completion_tokens:
|
|
224
|
-
prompt_cache_hit_tokens:
|
|
225
|
-
prompt_cache_miss_tokens:
|
|
226
|
-
total_tokens:
|
|
227
|
-
completion_tokens_details:
|
|
228
|
-
reasoning_tokens:
|
|
212
|
+
import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
|
|
213
|
+
import { z } from "zod/v4";
|
|
214
|
+
var tokenUsageSchema = z.object({
|
|
215
|
+
prompt_tokens: z.number().nullish(),
|
|
216
|
+
completion_tokens: z.number().nullish(),
|
|
217
|
+
prompt_cache_hit_tokens: z.number().nullish(),
|
|
218
|
+
prompt_cache_miss_tokens: z.number().nullish(),
|
|
219
|
+
total_tokens: z.number().nullish(),
|
|
220
|
+
completion_tokens_details: z.object({
|
|
221
|
+
reasoning_tokens: z.number().nullish()
|
|
229
222
|
}).nullish()
|
|
230
223
|
}).nullish();
|
|
231
|
-
var deepSeekErrorSchema =
|
|
232
|
-
error:
|
|
233
|
-
message:
|
|
234
|
-
type:
|
|
235
|
-
param:
|
|
236
|
-
code:
|
|
224
|
+
var deepSeekErrorSchema = z.object({
|
|
225
|
+
error: z.object({
|
|
226
|
+
message: z.string(),
|
|
227
|
+
type: z.string().nullish(),
|
|
228
|
+
param: z.any().nullish(),
|
|
229
|
+
code: z.union([z.string(), z.number()]).nullish()
|
|
237
230
|
})
|
|
238
231
|
});
|
|
239
|
-
var deepseekChatResponseSchema =
|
|
240
|
-
id:
|
|
241
|
-
created:
|
|
242
|
-
model:
|
|
243
|
-
choices:
|
|
244
|
-
|
|
245
|
-
message:
|
|
246
|
-
role:
|
|
247
|
-
content:
|
|
248
|
-
reasoning_content:
|
|
249
|
-
tool_calls:
|
|
250
|
-
|
|
251
|
-
id:
|
|
252
|
-
function:
|
|
253
|
-
name:
|
|
254
|
-
arguments:
|
|
232
|
+
var deepseekChatResponseSchema = z.object({
|
|
233
|
+
id: z.string().nullish(),
|
|
234
|
+
created: z.number().nullish(),
|
|
235
|
+
model: z.string().nullish(),
|
|
236
|
+
choices: z.array(
|
|
237
|
+
z.object({
|
|
238
|
+
message: z.object({
|
|
239
|
+
role: z.literal("assistant").nullish(),
|
|
240
|
+
content: z.string().nullish(),
|
|
241
|
+
reasoning_content: z.string().nullish(),
|
|
242
|
+
tool_calls: z.array(
|
|
243
|
+
z.object({
|
|
244
|
+
id: z.string().nullish(),
|
|
245
|
+
function: z.object({
|
|
246
|
+
name: z.string(),
|
|
247
|
+
arguments: z.string()
|
|
255
248
|
})
|
|
256
249
|
})
|
|
257
250
|
).nullish()
|
|
258
251
|
}),
|
|
259
|
-
finish_reason:
|
|
252
|
+
finish_reason: z.string().nullish()
|
|
260
253
|
})
|
|
261
254
|
),
|
|
262
255
|
usage: tokenUsageSchema
|
|
263
256
|
});
|
|
264
|
-
var deepseekChatChunkSchema =
|
|
265
|
-
() =>
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
id:
|
|
269
|
-
created:
|
|
270
|
-
model:
|
|
271
|
-
choices:
|
|
272
|
-
|
|
273
|
-
delta:
|
|
274
|
-
role:
|
|
275
|
-
content:
|
|
276
|
-
reasoning_content:
|
|
277
|
-
tool_calls:
|
|
278
|
-
|
|
279
|
-
index:
|
|
280
|
-
id:
|
|
281
|
-
function:
|
|
282
|
-
name:
|
|
283
|
-
arguments:
|
|
257
|
+
var deepseekChatChunkSchema = lazySchema(
|
|
258
|
+
() => zodSchema(
|
|
259
|
+
z.union([
|
|
260
|
+
z.object({
|
|
261
|
+
id: z.string().nullish(),
|
|
262
|
+
created: z.number().nullish(),
|
|
263
|
+
model: z.string().nullish(),
|
|
264
|
+
choices: z.array(
|
|
265
|
+
z.object({
|
|
266
|
+
delta: z.object({
|
|
267
|
+
role: z.enum(["assistant"]).nullish(),
|
|
268
|
+
content: z.string().nullish(),
|
|
269
|
+
reasoning_content: z.string().nullish(),
|
|
270
|
+
tool_calls: z.array(
|
|
271
|
+
z.object({
|
|
272
|
+
index: z.number(),
|
|
273
|
+
id: z.string().nullish(),
|
|
274
|
+
function: z.object({
|
|
275
|
+
name: z.string().nullish(),
|
|
276
|
+
arguments: z.string().nullish()
|
|
284
277
|
})
|
|
285
278
|
})
|
|
286
279
|
).nullish()
|
|
287
280
|
}).nullish(),
|
|
288
|
-
finish_reason:
|
|
281
|
+
finish_reason: z.string().nullish()
|
|
289
282
|
})
|
|
290
283
|
),
|
|
291
284
|
usage: tokenUsageSchema
|
|
@@ -296,13 +289,13 @@ var deepseekChatChunkSchema = (0, import_provider_utils.lazySchema)(
|
|
|
296
289
|
);
|
|
297
290
|
|
|
298
291
|
// src/chat/deepseek-chat-options.ts
|
|
299
|
-
|
|
300
|
-
var deepseekLanguageModelOptions =
|
|
292
|
+
import { z as z2 } from "zod/v4";
|
|
293
|
+
var deepseekLanguageModelOptions = z2.object({
|
|
301
294
|
/**
|
|
302
295
|
* Type of thinking to use. Defaults to `enabled`.
|
|
303
296
|
*/
|
|
304
|
-
thinking:
|
|
305
|
-
type:
|
|
297
|
+
thinking: z2.object({
|
|
298
|
+
type: z2.enum(["enabled", "disabled"]).optional()
|
|
306
299
|
}).optional()
|
|
307
300
|
});
|
|
308
301
|
|
|
@@ -401,17 +394,26 @@ function mapDeepSeekFinishReason(finishReason) {
|
|
|
401
394
|
}
|
|
402
395
|
|
|
403
396
|
// src/chat/deepseek-chat-language-model.ts
|
|
404
|
-
var DeepSeekChatLanguageModel = class {
|
|
397
|
+
var DeepSeekChatLanguageModel = class _DeepSeekChatLanguageModel {
|
|
405
398
|
constructor(modelId, config) {
|
|
406
399
|
this.specificationVersion = "v4";
|
|
407
400
|
this.supportedUrls = {};
|
|
408
401
|
this.modelId = modelId;
|
|
409
402
|
this.config = config;
|
|
410
|
-
this.failedResponseHandler =
|
|
403
|
+
this.failedResponseHandler = createJsonErrorResponseHandler({
|
|
411
404
|
errorSchema: deepSeekErrorSchema,
|
|
412
405
|
errorToMessage: (error) => error.error.message
|
|
413
406
|
});
|
|
414
407
|
}
|
|
408
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
409
|
+
return serializeModelOptions({
|
|
410
|
+
modelId: model.modelId,
|
|
411
|
+
config: model.config
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
415
|
+
return new _DeepSeekChatLanguageModel(options.modelId, options.config);
|
|
416
|
+
}
|
|
415
417
|
get provider() {
|
|
416
418
|
return this.config.provider;
|
|
417
419
|
}
|
|
@@ -435,7 +437,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
435
437
|
tools
|
|
436
438
|
}) {
|
|
437
439
|
var _a, _b;
|
|
438
|
-
const deepseekOptions = (_a = await
|
|
440
|
+
const deepseekOptions = (_a = await parseProviderOptions({
|
|
439
441
|
provider: this.providerOptionsName,
|
|
440
442
|
providerOptions,
|
|
441
443
|
schema: deepseekLanguageModelOptions
|
|
@@ -471,27 +473,27 @@ var DeepSeekChatLanguageModel = class {
|
|
|
471
473
|
messages,
|
|
472
474
|
tools: deepseekTools,
|
|
473
475
|
tool_choice: deepseekToolChoices,
|
|
474
|
-
thinking: ((_b = deepseekOptions.thinking) == null ? void 0 : _b.type) != null ? { type: deepseekOptions.thinking.type } :
|
|
476
|
+
thinking: ((_b = deepseekOptions.thinking) == null ? void 0 : _b.type) != null ? { type: deepseekOptions.thinking.type } : isCustomReasoning(reasoning) ? { type: reasoning === "none" ? "disabled" : "enabled" } : void 0
|
|
475
477
|
},
|
|
476
478
|
warnings: [...warnings, ...toolWarnings]
|
|
477
479
|
};
|
|
478
480
|
}
|
|
479
481
|
async doGenerate(options) {
|
|
480
|
-
var _a, _b, _c, _d;
|
|
482
|
+
var _a, _b, _c, _d, _e, _f;
|
|
481
483
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
482
484
|
const {
|
|
483
485
|
responseHeaders,
|
|
484
486
|
value: responseBody,
|
|
485
487
|
rawValue: rawResponse
|
|
486
|
-
} = await
|
|
488
|
+
} = await postJsonToApi({
|
|
487
489
|
url: this.config.url({
|
|
488
490
|
path: "/chat/completions",
|
|
489
491
|
modelId: this.modelId
|
|
490
492
|
}),
|
|
491
|
-
headers: (
|
|
493
|
+
headers: combineHeaders((_b = (_a = this.config).headers) == null ? void 0 : _b.call(_a), options.headers),
|
|
492
494
|
body: args,
|
|
493
495
|
failedResponseHandler: this.failedResponseHandler,
|
|
494
|
-
successfulResponseHandler:
|
|
496
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
495
497
|
deepseekChatResponseSchema
|
|
496
498
|
),
|
|
497
499
|
abortSignal: options.abortSignal,
|
|
@@ -510,7 +512,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
510
512
|
for (const toolCall of choice.message.tool_calls) {
|
|
511
513
|
content.push({
|
|
512
514
|
type: "tool-call",
|
|
513
|
-
toolCallId: (
|
|
515
|
+
toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
|
|
514
516
|
toolName: toolCall.function.name,
|
|
515
517
|
input: toolCall.function.arguments
|
|
516
518
|
});
|
|
@@ -524,13 +526,13 @@ var DeepSeekChatLanguageModel = class {
|
|
|
524
526
|
content,
|
|
525
527
|
finishReason: {
|
|
526
528
|
unified: mapDeepSeekFinishReason(choice.finish_reason),
|
|
527
|
-
raw: (
|
|
529
|
+
raw: (_d = choice.finish_reason) != null ? _d : void 0
|
|
528
530
|
},
|
|
529
531
|
usage: convertDeepSeekUsage(responseBody.usage),
|
|
530
532
|
providerMetadata: {
|
|
531
533
|
[this.providerOptionsName]: {
|
|
532
|
-
promptCacheHitTokens: (
|
|
533
|
-
promptCacheMissTokens: (
|
|
534
|
+
promptCacheHitTokens: (_e = responseBody.usage) == null ? void 0 : _e.prompt_cache_hit_tokens,
|
|
535
|
+
promptCacheMissTokens: (_f = responseBody.usage) == null ? void 0 : _f.prompt_cache_miss_tokens
|
|
534
536
|
}
|
|
535
537
|
},
|
|
536
538
|
request: { body: args },
|
|
@@ -543,21 +545,22 @@ var DeepSeekChatLanguageModel = class {
|
|
|
543
545
|
};
|
|
544
546
|
}
|
|
545
547
|
async doStream(options) {
|
|
548
|
+
var _a, _b;
|
|
546
549
|
const { args, warnings } = await this.getArgs({ ...options });
|
|
547
550
|
const body = {
|
|
548
551
|
...args,
|
|
549
552
|
stream: true,
|
|
550
553
|
stream_options: { include_usage: true }
|
|
551
554
|
};
|
|
552
|
-
const { responseHeaders, value: response } = await
|
|
555
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
553
556
|
url: this.config.url({
|
|
554
557
|
path: "/chat/completions",
|
|
555
558
|
modelId: this.modelId
|
|
556
559
|
}),
|
|
557
|
-
headers: (
|
|
560
|
+
headers: combineHeaders((_b = (_a = this.config).headers) == null ? void 0 : _b.call(_a), options.headers),
|
|
558
561
|
body,
|
|
559
562
|
failedResponseHandler: this.failedResponseHandler,
|
|
560
|
-
successfulResponseHandler:
|
|
563
|
+
successfulResponseHandler: createEventSourceResponseHandler(
|
|
561
564
|
deepseekChatChunkSchema
|
|
562
565
|
),
|
|
563
566
|
abortSignal: options.abortSignal,
|
|
@@ -580,7 +583,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
580
583
|
controller.enqueue({ type: "stream-start", warnings });
|
|
581
584
|
},
|
|
582
585
|
transform(chunk, controller) {
|
|
583
|
-
var
|
|
586
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
584
587
|
if (options.includeRawChunks) {
|
|
585
588
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
586
589
|
}
|
|
@@ -661,13 +664,13 @@ var DeepSeekChatLanguageModel = class {
|
|
|
661
664
|
const index = toolCallDelta.index;
|
|
662
665
|
if (toolCalls[index] == null) {
|
|
663
666
|
if (toolCallDelta.id == null) {
|
|
664
|
-
throw new
|
|
667
|
+
throw new InvalidResponseDataError({
|
|
665
668
|
data: toolCallDelta,
|
|
666
669
|
message: `Expected 'id' to be a string.`
|
|
667
670
|
});
|
|
668
671
|
}
|
|
669
|
-
if (((
|
|
670
|
-
throw new
|
|
672
|
+
if (((_a2 = toolCallDelta.function) == null ? void 0 : _a2.name) == null) {
|
|
673
|
+
throw new InvalidResponseDataError({
|
|
671
674
|
data: toolCallDelta,
|
|
672
675
|
message: `Expected 'function.name' to be a string.`
|
|
673
676
|
});
|
|
@@ -682,7 +685,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
682
685
|
type: "function",
|
|
683
686
|
function: {
|
|
684
687
|
name: toolCallDelta.function.name,
|
|
685
|
-
arguments: (
|
|
688
|
+
arguments: (_b2 = toolCallDelta.function.arguments) != null ? _b2 : ""
|
|
686
689
|
},
|
|
687
690
|
hasFinished: false
|
|
688
691
|
};
|
|
@@ -695,14 +698,14 @@ var DeepSeekChatLanguageModel = class {
|
|
|
695
698
|
delta: toolCall2.function.arguments
|
|
696
699
|
});
|
|
697
700
|
}
|
|
698
|
-
if (
|
|
701
|
+
if (isParsableJson(toolCall2.function.arguments)) {
|
|
699
702
|
controller.enqueue({
|
|
700
703
|
type: "tool-input-end",
|
|
701
704
|
id: toolCall2.id
|
|
702
705
|
});
|
|
703
706
|
controller.enqueue({
|
|
704
707
|
type: "tool-call",
|
|
705
|
-
toolCallId: (_e = toolCall2.id) != null ? _e :
|
|
708
|
+
toolCallId: (_e = toolCall2.id) != null ? _e : generateId(),
|
|
706
709
|
toolName: toolCall2.function.name,
|
|
707
710
|
input: toolCall2.function.arguments
|
|
708
711
|
});
|
|
@@ -723,14 +726,14 @@ var DeepSeekChatLanguageModel = class {
|
|
|
723
726
|
id: toolCall.id,
|
|
724
727
|
delta: (_i = toolCallDelta.function.arguments) != null ? _i : ""
|
|
725
728
|
});
|
|
726
|
-
if (((_j = toolCall.function) == null ? void 0 : _j.name) != null && ((_k = toolCall.function) == null ? void 0 : _k.arguments) != null &&
|
|
729
|
+
if (((_j = toolCall.function) == null ? void 0 : _j.name) != null && ((_k = toolCall.function) == null ? void 0 : _k.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
727
730
|
controller.enqueue({
|
|
728
731
|
type: "tool-input-end",
|
|
729
732
|
id: toolCall.id
|
|
730
733
|
});
|
|
731
734
|
controller.enqueue({
|
|
732
735
|
type: "tool-call",
|
|
733
|
-
toolCallId: (_l = toolCall.id) != null ? _l :
|
|
736
|
+
toolCallId: (_l = toolCall.id) != null ? _l : generateId(),
|
|
734
737
|
toolName: toolCall.function.name,
|
|
735
738
|
input: toolCall.function.arguments
|
|
736
739
|
});
|
|
@@ -740,7 +743,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
740
743
|
}
|
|
741
744
|
},
|
|
742
745
|
flush(controller) {
|
|
743
|
-
var
|
|
746
|
+
var _a2, _b2, _c;
|
|
744
747
|
if (isActiveReasoning) {
|
|
745
748
|
controller.enqueue({ type: "reasoning-end", id: "reasoning-0" });
|
|
746
749
|
}
|
|
@@ -756,7 +759,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
756
759
|
});
|
|
757
760
|
controller.enqueue({
|
|
758
761
|
type: "tool-call",
|
|
759
|
-
toolCallId: (
|
|
762
|
+
toolCallId: (_a2 = toolCall.id) != null ? _a2 : generateId(),
|
|
760
763
|
toolName: toolCall.function.name,
|
|
761
764
|
input: toolCall.function.arguments
|
|
762
765
|
});
|
|
@@ -767,7 +770,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
767
770
|
usage: convertDeepSeekUsage(usage),
|
|
768
771
|
providerMetadata: {
|
|
769
772
|
[providerOptionsName]: {
|
|
770
|
-
promptCacheHitTokens: (
|
|
773
|
+
promptCacheHitTokens: (_b2 = usage == null ? void 0 : usage.prompt_cache_hit_tokens) != null ? _b2 : void 0,
|
|
771
774
|
promptCacheMissTokens: (_c = usage == null ? void 0 : usage.prompt_cache_miss_tokens) != null ? _c : void 0
|
|
772
775
|
}
|
|
773
776
|
}
|
|
@@ -782,17 +785,17 @@ var DeepSeekChatLanguageModel = class {
|
|
|
782
785
|
};
|
|
783
786
|
|
|
784
787
|
// src/version.ts
|
|
785
|
-
var VERSION = true ? "3.0.0-beta.
|
|
788
|
+
var VERSION = true ? "3.0.0-beta.23" : "0.0.0-test";
|
|
786
789
|
|
|
787
790
|
// src/deepseek-provider.ts
|
|
788
791
|
function createDeepSeek(options = {}) {
|
|
789
792
|
var _a;
|
|
790
|
-
const baseURL =
|
|
793
|
+
const baseURL = withoutTrailingSlash(
|
|
791
794
|
(_a = options.baseURL) != null ? _a : "https://api.deepseek.com"
|
|
792
795
|
);
|
|
793
|
-
const getHeaders = () =>
|
|
796
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
794
797
|
{
|
|
795
|
-
Authorization: `Bearer ${
|
|
798
|
+
Authorization: `Bearer ${loadApiKey({
|
|
796
799
|
apiKey: options.apiKey,
|
|
797
800
|
environmentVariableName: "DEEPSEEK_API_KEY",
|
|
798
801
|
description: "DeepSeek API key"
|
|
@@ -814,19 +817,18 @@ function createDeepSeek(options = {}) {
|
|
|
814
817
|
provider.languageModel = createLanguageModel;
|
|
815
818
|
provider.chat = createLanguageModel;
|
|
816
819
|
provider.embeddingModel = (modelId) => {
|
|
817
|
-
throw new
|
|
820
|
+
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
818
821
|
};
|
|
819
822
|
provider.textEmbeddingModel = provider.embeddingModel;
|
|
820
823
|
provider.imageModel = (modelId) => {
|
|
821
|
-
throw new
|
|
824
|
+
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
822
825
|
};
|
|
823
826
|
return provider;
|
|
824
827
|
}
|
|
825
828
|
var deepseek = createDeepSeek();
|
|
826
|
-
|
|
827
|
-
0 && (module.exports = {
|
|
829
|
+
export {
|
|
828
830
|
VERSION,
|
|
829
831
|
createDeepSeek,
|
|
830
832
|
deepseek
|
|
831
|
-
}
|
|
833
|
+
};
|
|
832
834
|
//# sourceMappingURL=index.js.map
|