@ai-sdk/deepseek 1.0.63 → 1.0.65

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/dist/index.mjs CHANGED
@@ -31,85 +31,124 @@ import {
31
31
  import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
32
32
 
33
33
  // src/chat/deepseek-chat-options.ts
34
+ import {
35
+ lazySchema,
36
+ zodSchema
37
+ } from "@ai-sdk/provider-utils";
34
38
  import { z } from "zod/v4";
35
- var deepseekChatOptions = z.object({
36
- /**
37
- * Whether to return log probabilities for generated tokens.
38
- */
39
- logprobs: z.boolean().optional(),
40
- /**
41
- * Number of most likely tokens to return at each token position.
42
- *
43
- * Setting this option automatically enables `logprobs`.
44
- */
45
- topLogprobs: z.number().int().min(0).max(20).optional(),
46
- /**
47
- * An opaque identifier for the end user. DeepSeek uses this identifier for
48
- * content-safety tracing and request isolation.
49
- *
50
- * Must contain only ASCII letters, numbers, underscores, and hyphens, and
51
- * must be at most 512 characters long.
52
- */
53
- userId: 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(),
54
- /**
55
- * Type of thinking to use. Defaults to `enabled`.
56
- */
57
- thinking: z.object({
58
- // `adaptive` is accepted at runtime for backwards compatibility and
59
- // mapped to `enabled`, but is intentionally excluded from the exported
60
- // provider options type.
61
- type: z.enum(["adaptive", "enabled", "disabled"]).optional()
62
- }).optional(),
63
- /**
64
- * Controls the thinking strength for DeepSeek V4 reasoning models.
65
- */
66
- // `medium` and `xhigh` are accepted at runtime for backwards compatibility
67
- // and mapped to canonical DeepSeek values, but are intentionally excluded
68
- // from the exported provider options type.
69
- reasoningEffort: z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
70
- /**
71
- * Whether to use strict JSON schema validation for structured outputs.
72
- * Only applies when the serving endpoint supports JSON schema response
73
- * formats (e.g. Azure). Defaults to `true`.
74
- */
75
- strictJsonSchema: z.boolean().optional()
76
- });
77
- var deepseekMessageProviderOptions = z.object({
78
- /**
79
- * The name of the participant represented by the message.
80
- *
81
- * Supported on system, user, and assistant messages.
82
- */
83
- name: z.string().optional()
84
- });
85
- var deepseekAssistantMessageProviderOptions = deepseekMessageProviderOptions.extend({
86
- /**
87
- * Whether the assistant message content is a prefix that DeepSeek should
88
- * continue. This beta feature is only supported on the final assistant
89
- * message when using a beta base URL.
90
- */
91
- prefix: z.literal(true).optional()
92
- });
39
+ function createDeepseekChatOptionsSchema() {
40
+ return z.object({
41
+ /**
42
+ * Whether to return log probabilities for generated tokens.
43
+ */
44
+ logprobs: z.boolean().optional(),
45
+ /**
46
+ * Number of most likely tokens to return at each token position.
47
+ *
48
+ * Setting this option automatically enables `logprobs`.
49
+ */
50
+ topLogprobs: z.number().int().min(0).max(20).optional(),
51
+ /**
52
+ * An opaque identifier for the end user. DeepSeek uses this identifier for
53
+ * content-safety tracing and request isolation.
54
+ *
55
+ * Must contain only ASCII letters, numbers, underscores, and hyphens, and
56
+ * must be at most 512 characters long.
57
+ */
58
+ userId: 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(),
59
+ /**
60
+ * Type of thinking to use. Defaults to `enabled`.
61
+ */
62
+ thinking: z.object({
63
+ // `adaptive` is accepted at runtime for backwards compatibility and
64
+ // mapped to `enabled`, but is intentionally excluded from the exported
65
+ // provider options type.
66
+ type: z.enum(["adaptive", "enabled", "disabled"]).optional()
67
+ }).optional(),
68
+ /**
69
+ * Controls the thinking strength for DeepSeek V4 reasoning models.
70
+ */
71
+ // `medium` and `xhigh` are accepted at runtime for backwards compatibility
72
+ // and mapped to canonical DeepSeek values, but are intentionally excluded
73
+ // from the exported provider options type.
74
+ reasoningEffort: z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
75
+ /**
76
+ * Whether to use strict JSON schema validation for structured outputs.
77
+ * Only applies when the serving endpoint supports JSON schema response
78
+ * formats (e.g. Azure). Defaults to `true`.
79
+ */
80
+ strictJsonSchema: z.boolean().optional()
81
+ });
82
+ }
83
+ var chatOptionsSchema;
84
+ function getDeepseekChatOptionsSchema() {
85
+ return chatOptionsSchema != null ? chatOptionsSchema : chatOptionsSchema = createDeepseekChatOptionsSchema();
86
+ }
87
+ var deepseekChatOptions = lazySchema(
88
+ () => zodSchema(getDeepseekChatOptionsSchema())
89
+ );
90
+ function createDeepseekMessageOptionsSchema() {
91
+ return z.object({
92
+ /**
93
+ * The name of the participant represented by the message.
94
+ *
95
+ * Supported on system, user, and assistant messages.
96
+ */
97
+ name: z.string().optional()
98
+ });
99
+ }
100
+ var messageOptionsSchema;
101
+ function getDeepseekMessageOptionsSchema() {
102
+ return messageOptionsSchema != null ? messageOptionsSchema : messageOptionsSchema = createDeepseekMessageOptionsSchema();
103
+ }
104
+ var deepseekMessageProviderOptions = lazySchema(
105
+ () => zodSchema(getDeepseekMessageOptionsSchema())
106
+ );
107
+ function createDeepseekAssistantMessageOptionsSchema() {
108
+ return getDeepseekMessageOptionsSchema().extend({
109
+ /**
110
+ * Whether the assistant message content is a prefix that DeepSeek should
111
+ * continue. This beta feature is only supported on the final assistant
112
+ * message when using a beta base URL.
113
+ */
114
+ prefix: z.literal(true).optional()
115
+ });
116
+ }
117
+ var assistantMessageOptionsSchema;
118
+ function getDeepseekAssistantMessageOptionsSchema() {
119
+ return assistantMessageOptionsSchema != null ? assistantMessageOptionsSchema : assistantMessageOptionsSchema = createDeepseekAssistantMessageOptionsSchema();
120
+ }
121
+ var deepseekAssistantMessageProviderOptions = lazySchema(
122
+ () => zodSchema(getDeepseekAssistantMessageOptionsSchema())
123
+ );
93
124
 
94
125
  // src/chat/deepseek-file-part-options.ts
126
+ import {
127
+ lazySchema as lazySchema2,
128
+ zodSchema as zodSchema2
129
+ } from "@ai-sdk/provider-utils";
95
130
  import { z as z2 } from "zod/v4";
96
- var deepseekFilePartProviderOptions = z2.object({
97
- /**
98
- * Controls how DeepSeek processes an image sent as an `image_url` part.
99
- *
100
- * @see https://api-docs.deepseek.com/api/create-chat-completion/
101
- */
102
- imageDetail: z2.enum(["low", "high", "original", "auto"]).optional(),
103
- /**
104
- * Sends inline image data as a DeepSeek `file` part using `file_data`
105
- * instead of an `image_url` data URL. When set, the file part's filename
106
- * is preserved.
107
- *
108
- * This option only applies to inline image data. It cannot be combined
109
- * with `imageDetail`.
110
- */
111
- fileData: z2.literal(true).optional()
112
- });
131
+ var deepseekFilePartProviderOptions = lazySchema2(
132
+ () => zodSchema2(
133
+ z2.object({
134
+ /**
135
+ * Controls how DeepSeek processes an image sent as an `image_url` part.
136
+ *
137
+ * @see https://api-docs.deepseek.com/api/create-chat-completion/
138
+ */
139
+ imageDetail: z2.enum(["low", "high", "original", "auto"]).optional(),
140
+ /**
141
+ * Sends inline image data as a DeepSeek `file` part using `file_data`
142
+ * instead of an `image_url` data URL. When set, the file part's filename
143
+ * is preserved.
144
+ *
145
+ * This option only applies to inline image data. It cannot be combined
146
+ * with `imageDetail`.
147
+ */
148
+ fileData: z2.literal(true).optional()
149
+ })
150
+ )
151
+ );
113
152
 
114
153
  // src/chat/is-deepseek-v4-model.ts
115
154
  function isDeepSeekV4Model(modelId) {
@@ -393,77 +432,105 @@ async function convertToDeepSeekChatMessages({
393
432
  }
394
433
 
395
434
  // src/chat/deepseek-chat-api-types.ts
396
- import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
435
+ import {
436
+ lazySchema as lazySchema3,
437
+ zodSchema as zodSchema3
438
+ } from "@ai-sdk/provider-utils";
397
439
  import { z as z3 } from "zod/v4";
398
- var tokenUsageSchema = z3.object({
399
- prompt_tokens: z3.number().nullish(),
400
- completion_tokens: z3.number().nullish(),
401
- prompt_cache_hit_tokens: z3.number().nullish(),
402
- prompt_cache_miss_tokens: z3.number().nullish(),
403
- total_tokens: z3.number().nullish(),
404
- prompt_tokens_details: z3.object({
405
- cached_tokens: z3.number().nullish()
406
- }).nullish(),
407
- completion_tokens_details: z3.object({
408
- reasoning_tokens: z3.number().nullish()
409
- }).nullish()
410
- }).nullish();
411
- var deepSeekErrorSchema = z3.object({
412
- error: z3.object({
413
- message: z3.string(),
414
- type: z3.string().nullish(),
415
- param: z3.any().nullish(),
416
- code: z3.union([z3.string(), z3.number()]).nullish()
417
- })
418
- });
419
- var deepseekChatLogprobSchema = z3.object({
420
- token: z3.string(),
421
- logprob: z3.number(),
422
- bytes: z3.array(z3.number()).nullable(),
423
- top_logprobs: z3.array(
424
- z3.object({
425
- token: z3.string(),
426
- logprob: z3.number(),
427
- bytes: z3.array(z3.number()).nullable()
440
+ function createTokenUsageSchema() {
441
+ return z3.object({
442
+ prompt_tokens: z3.number().nullish(),
443
+ completion_tokens: z3.number().nullish(),
444
+ prompt_cache_hit_tokens: z3.number().nullish(),
445
+ prompt_cache_miss_tokens: z3.number().nullish(),
446
+ total_tokens: z3.number().nullish(),
447
+ prompt_tokens_details: z3.object({
448
+ cached_tokens: z3.number().nullish()
449
+ }).nullish(),
450
+ completion_tokens_details: z3.object({
451
+ reasoning_tokens: z3.number().nullish()
452
+ }).nullish()
453
+ }).nullish();
454
+ }
455
+ var tokenUsageSchema;
456
+ function getTokenUsageSchema() {
457
+ return tokenUsageSchema != null ? tokenUsageSchema : tokenUsageSchema = createTokenUsageSchema();
458
+ }
459
+ function createDeepSeekErrorSchema() {
460
+ return z3.object({
461
+ error: z3.object({
462
+ message: z3.string(),
463
+ type: z3.string().nullish(),
464
+ param: z3.any().nullish(),
465
+ code: z3.union([z3.string(), z3.number()]).nullish()
428
466
  })
429
- )
430
- });
431
- var deepseekChatLogprobsSchema = z3.object({
432
- content: z3.array(deepseekChatLogprobSchema).nullish(),
433
- reasoning_content: z3.array(deepseekChatLogprobSchema).nullish()
434
- }).nullish();
435
- var deepseekChatResponseSchema = z3.object({
436
- id: z3.string().nullish(),
437
- created: z3.number().nullish(),
438
- model: z3.string().nullish(),
439
- object: z3.literal("chat.completion").nullish(),
440
- system_fingerprint: z3.string().nullish(),
441
- choices: z3.array(
467
+ });
468
+ }
469
+ var errorSchema;
470
+ function getDeepSeekErrorSchema() {
471
+ return errorSchema != null ? errorSchema : errorSchema = createDeepSeekErrorSchema();
472
+ }
473
+ var deepSeekErrorSchema = lazySchema3(
474
+ () => zodSchema3(getDeepSeekErrorSchema())
475
+ );
476
+ function createDeepseekChatLogprobsSchema() {
477
+ const deepseekChatLogprobSchema = z3.object({
478
+ token: z3.string(),
479
+ logprob: z3.number(),
480
+ bytes: z3.array(z3.number()).nullable(),
481
+ top_logprobs: z3.array(
482
+ z3.object({
483
+ token: z3.string(),
484
+ logprob: z3.number(),
485
+ bytes: z3.array(z3.number()).nullable()
486
+ })
487
+ )
488
+ });
489
+ return z3.object({
490
+ content: z3.array(deepseekChatLogprobSchema).nullish(),
491
+ reasoning_content: z3.array(deepseekChatLogprobSchema).nullish()
492
+ }).nullish();
493
+ }
494
+ var logprobsSchema;
495
+ function getDeepseekChatLogprobsSchema() {
496
+ return logprobsSchema != null ? logprobsSchema : logprobsSchema = createDeepseekChatLogprobsSchema();
497
+ }
498
+ var deepseekChatResponseSchema = lazySchema3(
499
+ () => zodSchema3(
442
500
  z3.object({
443
- index: z3.number().nullish(),
444
- message: z3.object({
445
- role: z3.literal("assistant").nullish(),
446
- content: z3.string().nullish(),
447
- reasoning_content: z3.string().nullish(),
448
- tool_calls: z3.array(
449
- z3.object({
450
- id: z3.string().nullish(),
451
- type: z3.literal("function").nullish(),
452
- function: z3.object({
453
- name: z3.string(),
454
- arguments: z3.string()
455
- })
456
- })
457
- ).nullish()
458
- }),
459
- logprobs: deepseekChatLogprobsSchema,
460
- finish_reason: z3.string().nullish()
501
+ id: z3.string().nullish(),
502
+ created: z3.number().nullish(),
503
+ model: z3.string().nullish(),
504
+ object: z3.literal("chat.completion").nullish(),
505
+ system_fingerprint: z3.string().nullish(),
506
+ choices: z3.array(
507
+ z3.object({
508
+ index: z3.number().nullish(),
509
+ message: z3.object({
510
+ role: z3.literal("assistant").nullish(),
511
+ content: z3.string().nullish(),
512
+ reasoning_content: z3.string().nullish(),
513
+ tool_calls: z3.array(
514
+ z3.object({
515
+ id: z3.string().nullish(),
516
+ type: z3.literal("function").nullish(),
517
+ function: z3.object({
518
+ name: z3.string(),
519
+ arguments: z3.string()
520
+ })
521
+ })
522
+ ).nullish()
523
+ }),
524
+ logprobs: getDeepseekChatLogprobsSchema(),
525
+ finish_reason: z3.string().nullish()
526
+ })
527
+ ),
528
+ usage: getTokenUsageSchema()
461
529
  })
462
- ),
463
- usage: tokenUsageSchema
464
- });
465
- var deepseekChatChunkSchema = lazySchema(
466
- () => zodSchema(
530
+ )
531
+ );
532
+ var deepseekChatChunkSchema = lazySchema3(
533
+ () => zodSchema3(
467
534
  z3.union([
468
535
  z3.object({
469
536
  id: z3.string().nullish(),
@@ -490,13 +557,13 @@ var deepseekChatChunkSchema = lazySchema(
490
557
  })
491
558
  ).nullish()
492
559
  }).nullish(),
493
- logprobs: deepseekChatLogprobsSchema,
560
+ logprobs: getDeepseekChatLogprobsSchema(),
494
561
  finish_reason: z3.string().nullish()
495
562
  })
496
563
  ),
497
- usage: tokenUsageSchema
564
+ usage: getTokenUsageSchema()
498
565
  }),
499
- deepSeekErrorSchema
566
+ getDeepSeekErrorSchema()
500
567
  ])
501
568
  )
502
569
  );
@@ -1119,7 +1186,7 @@ var DeepSeekChatLanguageModel = class {
1119
1186
  };
1120
1187
 
1121
1188
  // src/version.ts
1122
- var VERSION = true ? "1.0.63" : "0.0.0-test";
1189
+ var VERSION = true ? "1.0.65" : "0.0.0-test";
1123
1190
 
1124
1191
  // src/deepseek-provider.ts
1125
1192
  function createDeepSeek(options = {}) {