@ai-sdk/deepseek 2.0.76 → 2.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 +9 -0
- package/dist/index.d.mts +25 -30
- package/dist/index.d.ts +25 -30
- package/dist/index.js +223 -165
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +213 -146
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +41 -31
- package/dist/internal/index.d.ts +41 -31
- package/dist/internal/index.js +229 -166
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +223 -151
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/chat/deepseek-chat-api-types.ts +128 -84
- package/src/chat/deepseek-chat-options.ts +109 -60
- package/src/chat/deepseek-file-part-options.ts +27 -18
- package/src/internal/index.ts +18 -1
package/dist/index.js
CHANGED
|
@@ -28,96 +28,129 @@ module.exports = __toCommonJS(index_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/deepseek-provider.ts
|
|
30
30
|
var import_provider4 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/chat/deepseek-chat-language-model.ts
|
|
34
34
|
var import_provider3 = require("@ai-sdk/provider");
|
|
35
|
-
var
|
|
35
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
36
36
|
|
|
37
37
|
// src/chat/convert-to-deepseek-chat-messages.ts
|
|
38
38
|
var import_provider = require("@ai-sdk/provider");
|
|
39
|
-
var
|
|
39
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
40
40
|
|
|
41
41
|
// src/chat/deepseek-chat-options.ts
|
|
42
|
+
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
42
43
|
var import_v4 = require("zod/v4");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
44
|
+
function createDeepseekChatOptionsSchema() {
|
|
45
|
+
return import_v4.z.object({
|
|
46
|
+
/**
|
|
47
|
+
* Whether to return log probabilities for generated tokens.
|
|
48
|
+
*/
|
|
49
|
+
logprobs: import_v4.z.boolean().optional(),
|
|
50
|
+
/**
|
|
51
|
+
* Number of most likely tokens to return at each token position.
|
|
52
|
+
*
|
|
53
|
+
* Setting this option automatically enables `logprobs`.
|
|
54
|
+
*/
|
|
55
|
+
topLogprobs: import_v4.z.number().int().min(0).max(20).optional(),
|
|
56
|
+
/**
|
|
57
|
+
* An opaque identifier for the end user. DeepSeek uses this identifier for
|
|
58
|
+
* content-safety tracing and request isolation.
|
|
59
|
+
*
|
|
60
|
+
* Must contain only ASCII letters, numbers, underscores, and hyphens, and
|
|
61
|
+
* must be at most 512 characters long.
|
|
62
|
+
*/
|
|
63
|
+
userId: import_v4.z.string().regex(/^[a-zA-Z0-9_-]+$/, "userId must match /^[a-zA-Z0-9_-]+$/").max(512, "userId must be at most 512 characters long").optional(),
|
|
64
|
+
/**
|
|
65
|
+
* Type of thinking to use. Defaults to `enabled`.
|
|
66
|
+
*/
|
|
67
|
+
thinking: import_v4.z.object({
|
|
68
|
+
// `adaptive` is accepted at runtime for backwards compatibility and
|
|
69
|
+
// mapped to `enabled`, but is intentionally excluded from the exported
|
|
70
|
+
// provider options type.
|
|
71
|
+
type: import_v4.z.enum(["adaptive", "enabled", "disabled"]).optional()
|
|
72
|
+
}).optional(),
|
|
73
|
+
/**
|
|
74
|
+
* Controls the thinking strength for DeepSeek V4 reasoning models.
|
|
75
|
+
*/
|
|
76
|
+
// `medium` and `xhigh` are accepted at runtime for backwards compatibility
|
|
77
|
+
// and mapped to canonical DeepSeek values, but are intentionally excluded
|
|
78
|
+
// from the exported provider options type.
|
|
79
|
+
reasoningEffort: import_v4.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
80
|
+
/**
|
|
81
|
+
* Whether to use strict JSON schema validation for structured outputs.
|
|
82
|
+
* Only applies when the serving endpoint supports JSON schema response
|
|
83
|
+
* formats (e.g. Azure). Defaults to `true`.
|
|
84
|
+
*/
|
|
85
|
+
strictJsonSchema: import_v4.z.boolean().optional()
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
var chatOptionsSchema;
|
|
89
|
+
function getDeepseekChatOptionsSchema() {
|
|
90
|
+
return chatOptionsSchema != null ? chatOptionsSchema : chatOptionsSchema = createDeepseekChatOptionsSchema();
|
|
91
|
+
}
|
|
92
|
+
var deepseekLanguageModelOptions = (0, import_provider_utils.lazySchema)(
|
|
93
|
+
() => (0, import_provider_utils.zodSchema)(getDeepseekChatOptionsSchema())
|
|
94
|
+
);
|
|
95
|
+
function createDeepseekMessageOptionsSchema() {
|
|
96
|
+
return import_v4.z.object({
|
|
97
|
+
/**
|
|
98
|
+
* The name of the participant represented by the message.
|
|
99
|
+
*
|
|
100
|
+
* Supported on system, user, and assistant messages.
|
|
101
|
+
*/
|
|
102
|
+
name: import_v4.z.string().optional()
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
var messageOptionsSchema;
|
|
106
|
+
function getDeepseekMessageOptionsSchema() {
|
|
107
|
+
return messageOptionsSchema != null ? messageOptionsSchema : messageOptionsSchema = createDeepseekMessageOptionsSchema();
|
|
108
|
+
}
|
|
109
|
+
var deepseekMessageProviderOptions = (0, import_provider_utils.lazySchema)(
|
|
110
|
+
() => (0, import_provider_utils.zodSchema)(getDeepseekMessageOptionsSchema())
|
|
111
|
+
);
|
|
112
|
+
function createDeepseekAssistantMessageOptionsSchema() {
|
|
113
|
+
return getDeepseekMessageOptionsSchema().extend({
|
|
114
|
+
/**
|
|
115
|
+
* Whether the assistant message content is a prefix that DeepSeek should
|
|
116
|
+
* continue. This beta feature is only supported on the final assistant
|
|
117
|
+
* message when using a beta base URL.
|
|
118
|
+
*/
|
|
119
|
+
prefix: import_v4.z.literal(true).optional()
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
var assistantMessageOptionsSchema;
|
|
123
|
+
function getDeepseekAssistantMessageOptionsSchema() {
|
|
124
|
+
return assistantMessageOptionsSchema != null ? assistantMessageOptionsSchema : assistantMessageOptionsSchema = createDeepseekAssistantMessageOptionsSchema();
|
|
125
|
+
}
|
|
126
|
+
var deepseekAssistantMessageProviderOptions = (0, import_provider_utils.lazySchema)(
|
|
127
|
+
() => (0, import_provider_utils.zodSchema)(getDeepseekAssistantMessageOptionsSchema())
|
|
128
|
+
);
|
|
101
129
|
|
|
102
130
|
// src/chat/deepseek-file-part-options.ts
|
|
131
|
+
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
103
132
|
var import_v42 = require("zod/v4");
|
|
104
|
-
var deepseekFilePartProviderOptions =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
var deepseekFilePartProviderOptions = (0, import_provider_utils2.lazySchema)(
|
|
134
|
+
() => (0, import_provider_utils2.zodSchema)(
|
|
135
|
+
import_v42.z.object({
|
|
136
|
+
/**
|
|
137
|
+
* Controls how DeepSeek processes an image sent as an `image_url` part.
|
|
138
|
+
*
|
|
139
|
+
* @see https://api-docs.deepseek.com/api/create-chat-completion/
|
|
140
|
+
*/
|
|
141
|
+
imageDetail: import_v42.z.enum(["low", "high", "original", "auto"]).optional(),
|
|
142
|
+
/**
|
|
143
|
+
* Sends inline image data as a DeepSeek `file` part using `file_data`
|
|
144
|
+
* instead of an `image_url` data URL. When set, the file part's filename
|
|
145
|
+
* is preserved.
|
|
146
|
+
*
|
|
147
|
+
* This option only applies to inline image data. It cannot be combined
|
|
148
|
+
* with `imageDetail`.
|
|
149
|
+
*/
|
|
150
|
+
fileData: import_v42.z.literal(true).optional()
|
|
151
|
+
})
|
|
152
|
+
)
|
|
153
|
+
);
|
|
121
154
|
|
|
122
155
|
// src/chat/is-deepseek-v4-model.ts
|
|
123
156
|
function isDeepSeekV4Model(modelId) {
|
|
@@ -174,7 +207,7 @@ async function convertToDeepSeekChatMessages({
|
|
|
174
207
|
let index = -1;
|
|
175
208
|
for (const { role, content, providerOptions } of prompt) {
|
|
176
209
|
index++;
|
|
177
|
-
const deepseekMessageOptions = await (0,
|
|
210
|
+
const deepseekMessageOptions = await (0, import_provider_utils3.parseProviderOptions)({
|
|
178
211
|
provider: providerOptionsName,
|
|
179
212
|
providerOptions,
|
|
180
213
|
schema: deepseekAssistantMessageProviderOptions
|
|
@@ -226,7 +259,7 @@ async function convertToDeepSeekChatMessages({
|
|
|
226
259
|
if (part.type === "text") {
|
|
227
260
|
userContent.push({ type: "text", text: part.text });
|
|
228
261
|
} else if (part.type === "file" && (part.mediaType === "image" || part.mediaType.startsWith("image/"))) {
|
|
229
|
-
const filePartOptions = await (0,
|
|
262
|
+
const filePartOptions = await (0, import_provider_utils3.parseProviderOptions)({
|
|
230
263
|
provider: providerOptionsName,
|
|
231
264
|
providerOptions: part.providerOptions,
|
|
232
265
|
schema: deepseekFilePartProviderOptions
|
|
@@ -262,7 +295,7 @@ async function convertToDeepSeekChatMessages({
|
|
|
262
295
|
}
|
|
263
296
|
});
|
|
264
297
|
} else {
|
|
265
|
-
const dataUrl = `data:${resolvedMediaType === "image/jpg" ? "image/jpeg" : resolvedMediaType};base64,${(0,
|
|
298
|
+
const dataUrl = `data:${resolvedMediaType === "image/jpg" ? "image/jpeg" : resolvedMediaType};base64,${(0, import_provider_utils3.convertToBase64)(part.data)}`;
|
|
266
299
|
if ((filePartOptions == null ? void 0 : filePartOptions.fileData) === true) {
|
|
267
300
|
if (filePartOptions.imageDetail != null) {
|
|
268
301
|
throw new import_provider.InvalidPromptError({
|
|
@@ -452,77 +485,102 @@ function convertDeepSeekUsage(usage) {
|
|
|
452
485
|
}
|
|
453
486
|
|
|
454
487
|
// src/chat/deepseek-chat-api-types.ts
|
|
455
|
-
var
|
|
488
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
456
489
|
var import_v43 = require("zod/v4");
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}).nullish()
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
import_v43.z.object({
|
|
484
|
-
token: import_v43.z.string(),
|
|
485
|
-
logprob: import_v43.z.number(),
|
|
486
|
-
bytes: import_v43.z.array(import_v43.z.number()).nullable()
|
|
490
|
+
function createTokenUsageSchema() {
|
|
491
|
+
return import_v43.z.looseObject({
|
|
492
|
+
prompt_tokens: import_v43.z.number().nullish(),
|
|
493
|
+
completion_tokens: import_v43.z.number().nullish(),
|
|
494
|
+
prompt_cache_hit_tokens: import_v43.z.number().nullish(),
|
|
495
|
+
prompt_cache_miss_tokens: import_v43.z.number().nullish(),
|
|
496
|
+
total_tokens: import_v43.z.number().nullish(),
|
|
497
|
+
prompt_tokens_details: import_v43.z.looseObject({
|
|
498
|
+
cached_tokens: import_v43.z.number().nullish()
|
|
499
|
+
}).nullish(),
|
|
500
|
+
completion_tokens_details: import_v43.z.looseObject({
|
|
501
|
+
reasoning_tokens: import_v43.z.number().nullish()
|
|
502
|
+
}).nullish()
|
|
503
|
+
}).nullish();
|
|
504
|
+
}
|
|
505
|
+
var tokenUsageSchema;
|
|
506
|
+
function getTokenUsageSchema() {
|
|
507
|
+
return tokenUsageSchema != null ? tokenUsageSchema : tokenUsageSchema = createTokenUsageSchema();
|
|
508
|
+
}
|
|
509
|
+
function createDeepSeekErrorSchema() {
|
|
510
|
+
return import_v43.z.object({
|
|
511
|
+
error: import_v43.z.object({
|
|
512
|
+
message: import_v43.z.string(),
|
|
513
|
+
type: import_v43.z.string().nullish(),
|
|
514
|
+
param: import_v43.z.any().nullish(),
|
|
515
|
+
code: import_v43.z.union([import_v43.z.string(), import_v43.z.number()]).nullish()
|
|
487
516
|
})
|
|
488
|
-
)
|
|
489
|
-
}
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
var errorSchema;
|
|
520
|
+
function getDeepSeekErrorSchema() {
|
|
521
|
+
return errorSchema != null ? errorSchema : errorSchema = createDeepSeekErrorSchema();
|
|
522
|
+
}
|
|
523
|
+
var deepSeekErrorSchema = (0, import_provider_utils4.lazySchema)(
|
|
524
|
+
() => (0, import_provider_utils4.zodSchema)(getDeepSeekErrorSchema())
|
|
525
|
+
);
|
|
526
|
+
function createDeepseekChatLogprobsSchema() {
|
|
527
|
+
const deepseekChatLogprobSchema = import_v43.z.object({
|
|
528
|
+
token: import_v43.z.string(),
|
|
529
|
+
logprob: import_v43.z.number(),
|
|
530
|
+
bytes: import_v43.z.array(import_v43.z.number()).nullable(),
|
|
531
|
+
top_logprobs: import_v43.z.array(
|
|
532
|
+
import_v43.z.object({
|
|
533
|
+
token: import_v43.z.string(),
|
|
534
|
+
logprob: import_v43.z.number(),
|
|
535
|
+
bytes: import_v43.z.array(import_v43.z.number()).nullable()
|
|
536
|
+
})
|
|
537
|
+
)
|
|
538
|
+
});
|
|
539
|
+
return import_v43.z.object({
|
|
540
|
+
content: import_v43.z.array(deepseekChatLogprobSchema).nullish(),
|
|
541
|
+
reasoning_content: import_v43.z.array(deepseekChatLogprobSchema).nullish()
|
|
542
|
+
}).nullish();
|
|
543
|
+
}
|
|
544
|
+
var logprobsSchema;
|
|
545
|
+
function getDeepseekChatLogprobsSchema() {
|
|
546
|
+
return logprobsSchema != null ? logprobsSchema : logprobsSchema = createDeepseekChatLogprobsSchema();
|
|
547
|
+
}
|
|
548
|
+
var deepseekChatResponseSchema = (0, import_provider_utils4.lazySchema)(
|
|
549
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
501
550
|
import_v43.z.object({
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
551
|
+
id: import_v43.z.string().nullish(),
|
|
552
|
+
created: import_v43.z.number().nullish(),
|
|
553
|
+
model: import_v43.z.string().nullish(),
|
|
554
|
+
object: import_v43.z.literal("chat.completion").nullish(),
|
|
555
|
+
system_fingerprint: import_v43.z.string().nullish(),
|
|
556
|
+
choices: import_v43.z.array(
|
|
557
|
+
import_v43.z.object({
|
|
558
|
+
index: import_v43.z.number().nullish(),
|
|
559
|
+
message: import_v43.z.object({
|
|
560
|
+
role: import_v43.z.literal("assistant").nullish(),
|
|
561
|
+
content: import_v43.z.string().nullish(),
|
|
562
|
+
reasoning_content: import_v43.z.string().nullish(),
|
|
563
|
+
tool_calls: import_v43.z.array(
|
|
564
|
+
import_v43.z.object({
|
|
565
|
+
id: import_v43.z.string().nullish(),
|
|
566
|
+
type: import_v43.z.literal("function").nullish(),
|
|
567
|
+
function: import_v43.z.object({
|
|
568
|
+
name: import_v43.z.string(),
|
|
569
|
+
arguments: import_v43.z.string()
|
|
570
|
+
})
|
|
571
|
+
})
|
|
572
|
+
).nullish()
|
|
573
|
+
}),
|
|
574
|
+
logprobs: getDeepseekChatLogprobsSchema(),
|
|
575
|
+
finish_reason: import_v43.z.string().nullish()
|
|
576
|
+
})
|
|
577
|
+
),
|
|
578
|
+
usage: getTokenUsageSchema()
|
|
520
579
|
})
|
|
521
|
-
)
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
() => (0, import_provider_utils2.zodSchema)(
|
|
580
|
+
)
|
|
581
|
+
);
|
|
582
|
+
var deepseekChatChunkSchema = (0, import_provider_utils4.lazySchema)(
|
|
583
|
+
() => (0, import_provider_utils4.zodSchema)(
|
|
526
584
|
import_v43.z.union([
|
|
527
585
|
import_v43.z.object({
|
|
528
586
|
id: import_v43.z.string().nullish(),
|
|
@@ -549,13 +607,13 @@ var deepseekChatChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
549
607
|
})
|
|
550
608
|
).nullish()
|
|
551
609
|
}).nullish(),
|
|
552
|
-
logprobs:
|
|
610
|
+
logprobs: getDeepseekChatLogprobsSchema(),
|
|
553
611
|
finish_reason: import_v43.z.string().nullish()
|
|
554
612
|
})
|
|
555
613
|
),
|
|
556
|
-
usage:
|
|
614
|
+
usage: getTokenUsageSchema()
|
|
557
615
|
}),
|
|
558
|
-
|
|
616
|
+
getDeepSeekErrorSchema()
|
|
559
617
|
])
|
|
560
618
|
)
|
|
561
619
|
);
|
|
@@ -693,7 +751,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
693
751
|
};
|
|
694
752
|
this.modelId = modelId;
|
|
695
753
|
this.config = config;
|
|
696
|
-
this.failedResponseHandler = (0,
|
|
754
|
+
this.failedResponseHandler = (0, import_provider_utils5.createJsonErrorResponseHandler)({
|
|
697
755
|
errorSchema: deepSeekErrorSchema,
|
|
698
756
|
errorToMessage: (error) => error.error.message
|
|
699
757
|
});
|
|
@@ -720,7 +778,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
720
778
|
tools
|
|
721
779
|
}) {
|
|
722
780
|
var _a, _b, _c, _d;
|
|
723
|
-
const deepseekOptions = (_a = await (0,
|
|
781
|
+
const deepseekOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
|
|
724
782
|
provider: this.providerOptionsName,
|
|
725
783
|
providerOptions,
|
|
726
784
|
schema: deepseekLanguageModelOptions
|
|
@@ -835,15 +893,15 @@ var DeepSeekChatLanguageModel = class {
|
|
|
835
893
|
responseHeaders,
|
|
836
894
|
value: responseBody,
|
|
837
895
|
rawValue: rawResponse
|
|
838
|
-
} = await (0,
|
|
896
|
+
} = await (0, import_provider_utils5.postJsonToApi)({
|
|
839
897
|
url: this.config.url({
|
|
840
898
|
path: "/chat/completions",
|
|
841
899
|
modelId: this.modelId
|
|
842
900
|
}),
|
|
843
|
-
headers: (0,
|
|
901
|
+
headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
|
|
844
902
|
body: args,
|
|
845
903
|
failedResponseHandler: this.failedResponseHandler,
|
|
846
|
-
successfulResponseHandler: (0,
|
|
904
|
+
successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
|
|
847
905
|
deepseekChatResponseSchema
|
|
848
906
|
),
|
|
849
907
|
abortSignal: options.abortSignal,
|
|
@@ -862,7 +920,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
862
920
|
for (const toolCall of choice.message.tool_calls) {
|
|
863
921
|
content.push({
|
|
864
922
|
type: "tool-call",
|
|
865
|
-
toolCallId: (_a = toolCall.id) != null ? _a : (0,
|
|
923
|
+
toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils5.generateId)(),
|
|
866
924
|
toolName: toolCall.function.name,
|
|
867
925
|
input: toolCall.function.arguments
|
|
868
926
|
});
|
|
@@ -915,15 +973,15 @@ var DeepSeekChatLanguageModel = class {
|
|
|
915
973
|
stream: true,
|
|
916
974
|
stream_options: { include_usage: true }
|
|
917
975
|
};
|
|
918
|
-
const { responseHeaders, value: response } = await (0,
|
|
976
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
|
|
919
977
|
url: this.config.url({
|
|
920
978
|
path: "/chat/completions",
|
|
921
979
|
modelId: this.modelId
|
|
922
980
|
}),
|
|
923
|
-
headers: (0,
|
|
981
|
+
headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
|
|
924
982
|
body,
|
|
925
983
|
failedResponseHandler: this.failedResponseHandler,
|
|
926
|
-
successfulResponseHandler: (0,
|
|
984
|
+
successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(
|
|
927
985
|
deepseekChatChunkSchema
|
|
928
986
|
),
|
|
929
987
|
abortSignal: options.abortSignal,
|
|
@@ -1124,7 +1182,7 @@ var DeepSeekChatLanguageModel = class {
|
|
|
1124
1182
|
});
|
|
1125
1183
|
controller.enqueue({
|
|
1126
1184
|
type: "tool-call",
|
|
1127
|
-
toolCallId: (_a = toolCall.id) != null ? _a : (0,
|
|
1185
|
+
toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils5.generateId)(),
|
|
1128
1186
|
toolName: toolCall.function.name,
|
|
1129
1187
|
input: toolCall.function.arguments
|
|
1130
1188
|
});
|
|
@@ -1167,15 +1225,15 @@ var DeepSeekChatLanguageModel = class {
|
|
|
1167
1225
|
};
|
|
1168
1226
|
|
|
1169
1227
|
// src/version.ts
|
|
1170
|
-
var VERSION = true ? "2.0.
|
|
1228
|
+
var VERSION = true ? "2.0.77" : "0.0.0-test";
|
|
1171
1229
|
|
|
1172
1230
|
// src/deepseek-provider.ts
|
|
1173
1231
|
function createDeepSeek(options = {}) {
|
|
1174
1232
|
var _a;
|
|
1175
|
-
const baseURL = (_a = (0,
|
|
1176
|
-
const getHeaders = () => (0,
|
|
1233
|
+
const baseURL = (_a = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.deepseek.com";
|
|
1234
|
+
const getHeaders = () => (0, import_provider_utils6.withUserAgentSuffix)(
|
|
1177
1235
|
{
|
|
1178
|
-
Authorization: `Bearer ${(0,
|
|
1236
|
+
Authorization: `Bearer ${(0, import_provider_utils6.loadApiKey)({
|
|
1179
1237
|
apiKey: options.apiKey,
|
|
1180
1238
|
environmentVariableName: "DEEPSEEK_API_KEY",
|
|
1181
1239
|
description: "DeepSeek API key"
|