@ai-sdk/deepseek 1.0.63 → 1.0.64

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.
@@ -1,3 +1,95 @@
1
+ // src/chat/deepseek-chat-options.ts
2
+ import {
3
+ lazySchema,
4
+ zodSchema
5
+ } from "@ai-sdk/provider-utils";
6
+ import { z } from "zod/v4";
7
+ function createDeepseekChatOptionsSchema() {
8
+ return z.object({
9
+ /**
10
+ * Whether to return log probabilities for generated tokens.
11
+ */
12
+ logprobs: z.boolean().optional(),
13
+ /**
14
+ * Number of most likely tokens to return at each token position.
15
+ *
16
+ * Setting this option automatically enables `logprobs`.
17
+ */
18
+ topLogprobs: z.number().int().min(0).max(20).optional(),
19
+ /**
20
+ * An opaque identifier for the end user. DeepSeek uses this identifier for
21
+ * content-safety tracing and request isolation.
22
+ *
23
+ * Must contain only ASCII letters, numbers, underscores, and hyphens, and
24
+ * must be at most 512 characters long.
25
+ */
26
+ 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(),
27
+ /**
28
+ * Type of thinking to use. Defaults to `enabled`.
29
+ */
30
+ thinking: z.object({
31
+ // `adaptive` is accepted at runtime for backwards compatibility and
32
+ // mapped to `enabled`, but is intentionally excluded from the exported
33
+ // provider options type.
34
+ type: z.enum(["adaptive", "enabled", "disabled"]).optional()
35
+ }).optional(),
36
+ /**
37
+ * Controls the thinking strength for DeepSeek V4 reasoning models.
38
+ */
39
+ // `medium` and `xhigh` are accepted at runtime for backwards compatibility
40
+ // and mapped to canonical DeepSeek values, but are intentionally excluded
41
+ // from the exported provider options type.
42
+ reasoningEffort: z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
43
+ /**
44
+ * Whether to use strict JSON schema validation for structured outputs.
45
+ * Only applies when the serving endpoint supports JSON schema response
46
+ * formats (e.g. Azure). Defaults to `true`.
47
+ */
48
+ strictJsonSchema: z.boolean().optional()
49
+ });
50
+ }
51
+ var chatOptionsSchema;
52
+ function getDeepseekChatOptionsSchema() {
53
+ return chatOptionsSchema != null ? chatOptionsSchema : chatOptionsSchema = createDeepseekChatOptionsSchema();
54
+ }
55
+ var deepseekChatOptions = lazySchema(
56
+ () => zodSchema(getDeepseekChatOptionsSchema())
57
+ );
58
+ function createDeepseekMessageOptionsSchema() {
59
+ return z.object({
60
+ /**
61
+ * The name of the participant represented by the message.
62
+ *
63
+ * Supported on system, user, and assistant messages.
64
+ */
65
+ name: z.string().optional()
66
+ });
67
+ }
68
+ var messageOptionsSchema;
69
+ function getDeepseekMessageOptionsSchema() {
70
+ return messageOptionsSchema != null ? messageOptionsSchema : messageOptionsSchema = createDeepseekMessageOptionsSchema();
71
+ }
72
+ var deepseekMessageProviderOptions = lazySchema(
73
+ () => zodSchema(getDeepseekMessageOptionsSchema())
74
+ );
75
+ function createDeepseekAssistantMessageOptionsSchema() {
76
+ return getDeepseekMessageOptionsSchema().extend({
77
+ /**
78
+ * Whether the assistant message content is a prefix that DeepSeek should
79
+ * continue. This beta feature is only supported on the final assistant
80
+ * message when using a beta base URL.
81
+ */
82
+ prefix: z.literal(true).optional()
83
+ });
84
+ }
85
+ var assistantMessageOptionsSchema;
86
+ function getDeepseekAssistantMessageOptionsSchema() {
87
+ return assistantMessageOptionsSchema != null ? assistantMessageOptionsSchema : assistantMessageOptionsSchema = createDeepseekAssistantMessageOptionsSchema();
88
+ }
89
+ var deepseekAssistantMessageProviderOptions = lazySchema(
90
+ () => zodSchema(getDeepseekAssistantMessageOptionsSchema())
91
+ );
92
+
1
93
  // src/chat/deepseek-chat-language-model.ts
2
94
  import {
3
95
  InvalidResponseDataError
@@ -20,86 +112,33 @@ import {
20
112
  } from "@ai-sdk/provider";
21
113
  import { convertToBase64, parseProviderOptions } from "@ai-sdk/provider-utils";
22
114
 
23
- // src/chat/deepseek-chat-options.ts
24
- import { z } from "zod/v4";
25
- var deepseekChatOptions = z.object({
26
- /**
27
- * Whether to return log probabilities for generated tokens.
28
- */
29
- logprobs: z.boolean().optional(),
30
- /**
31
- * Number of most likely tokens to return at each token position.
32
- *
33
- * Setting this option automatically enables `logprobs`.
34
- */
35
- topLogprobs: z.number().int().min(0).max(20).optional(),
36
- /**
37
- * An opaque identifier for the end user. DeepSeek uses this identifier for
38
- * content-safety tracing and request isolation.
39
- *
40
- * Must contain only ASCII letters, numbers, underscores, and hyphens, and
41
- * must be at most 512 characters long.
42
- */
43
- 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(),
44
- /**
45
- * Type of thinking to use. Defaults to `enabled`.
46
- */
47
- thinking: z.object({
48
- // `adaptive` is accepted at runtime for backwards compatibility and
49
- // mapped to `enabled`, but is intentionally excluded from the exported
50
- // provider options type.
51
- type: z.enum(["adaptive", "enabled", "disabled"]).optional()
52
- }).optional(),
53
- /**
54
- * Controls the thinking strength for DeepSeek V4 reasoning models.
55
- */
56
- // `medium` and `xhigh` are accepted at runtime for backwards compatibility
57
- // and mapped to canonical DeepSeek values, but are intentionally excluded
58
- // from the exported provider options type.
59
- reasoningEffort: z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
60
- /**
61
- * Whether to use strict JSON schema validation for structured outputs.
62
- * Only applies when the serving endpoint supports JSON schema response
63
- * formats (e.g. Azure). Defaults to `true`.
64
- */
65
- strictJsonSchema: z.boolean().optional()
66
- });
67
- var deepseekMessageProviderOptions = z.object({
68
- /**
69
- * The name of the participant represented by the message.
70
- *
71
- * Supported on system, user, and assistant messages.
72
- */
73
- name: z.string().optional()
74
- });
75
- var deepseekAssistantMessageProviderOptions = deepseekMessageProviderOptions.extend({
76
- /**
77
- * Whether the assistant message content is a prefix that DeepSeek should
78
- * continue. This beta feature is only supported on the final assistant
79
- * message when using a beta base URL.
80
- */
81
- prefix: z.literal(true).optional()
82
- });
83
-
84
115
  // src/chat/deepseek-file-part-options.ts
116
+ import {
117
+ lazySchema as lazySchema2,
118
+ zodSchema as zodSchema2
119
+ } from "@ai-sdk/provider-utils";
85
120
  import { z as z2 } from "zod/v4";
86
- var deepseekFilePartProviderOptions = z2.object({
87
- /**
88
- * Controls how DeepSeek processes an image sent as an `image_url` part.
89
- *
90
- * @see https://api-docs.deepseek.com/api/create-chat-completion/
91
- */
92
- imageDetail: z2.enum(["low", "high", "original", "auto"]).optional(),
93
- /**
94
- * Sends inline image data as a DeepSeek `file` part using `file_data`
95
- * instead of an `image_url` data URL. When set, the file part's filename
96
- * is preserved.
97
- *
98
- * This option only applies to inline image data. It cannot be combined
99
- * with `imageDetail`.
100
- */
101
- fileData: z2.literal(true).optional()
102
- });
121
+ var deepseekFilePartProviderOptions = lazySchema2(
122
+ () => zodSchema2(
123
+ z2.object({
124
+ /**
125
+ * Controls how DeepSeek processes an image sent as an `image_url` part.
126
+ *
127
+ * @see https://api-docs.deepseek.com/api/create-chat-completion/
128
+ */
129
+ imageDetail: z2.enum(["low", "high", "original", "auto"]).optional(),
130
+ /**
131
+ * Sends inline image data as a DeepSeek `file` part using `file_data`
132
+ * instead of an `image_url` data URL. When set, the file part's filename
133
+ * is preserved.
134
+ *
135
+ * This option only applies to inline image data. It cannot be combined
136
+ * with `imageDetail`.
137
+ */
138
+ fileData: z2.literal(true).optional()
139
+ })
140
+ )
141
+ );
103
142
 
104
143
  // src/chat/is-deepseek-v4-model.ts
105
144
  function isDeepSeekV4Model(modelId) {
@@ -383,77 +422,105 @@ async function convertToDeepSeekChatMessages({
383
422
  }
384
423
 
385
424
  // src/chat/deepseek-chat-api-types.ts
386
- import { lazySchema, zodSchema } from "@ai-sdk/provider-utils";
425
+ import {
426
+ lazySchema as lazySchema3,
427
+ zodSchema as zodSchema3
428
+ } from "@ai-sdk/provider-utils";
387
429
  import { z as z3 } from "zod/v4";
388
- var tokenUsageSchema = z3.object({
389
- prompt_tokens: z3.number().nullish(),
390
- completion_tokens: z3.number().nullish(),
391
- prompt_cache_hit_tokens: z3.number().nullish(),
392
- prompt_cache_miss_tokens: z3.number().nullish(),
393
- total_tokens: z3.number().nullish(),
394
- prompt_tokens_details: z3.object({
395
- cached_tokens: z3.number().nullish()
396
- }).nullish(),
397
- completion_tokens_details: z3.object({
398
- reasoning_tokens: z3.number().nullish()
399
- }).nullish()
400
- }).nullish();
401
- var deepSeekErrorSchema = z3.object({
402
- error: z3.object({
403
- message: z3.string(),
404
- type: z3.string().nullish(),
405
- param: z3.any().nullish(),
406
- code: z3.union([z3.string(), z3.number()]).nullish()
407
- })
408
- });
409
- var deepseekChatLogprobSchema = z3.object({
410
- token: z3.string(),
411
- logprob: z3.number(),
412
- bytes: z3.array(z3.number()).nullable(),
413
- top_logprobs: z3.array(
414
- z3.object({
415
- token: z3.string(),
416
- logprob: z3.number(),
417
- bytes: z3.array(z3.number()).nullable()
430
+ function createTokenUsageSchema() {
431
+ return z3.object({
432
+ prompt_tokens: z3.number().nullish(),
433
+ completion_tokens: z3.number().nullish(),
434
+ prompt_cache_hit_tokens: z3.number().nullish(),
435
+ prompt_cache_miss_tokens: z3.number().nullish(),
436
+ total_tokens: z3.number().nullish(),
437
+ prompt_tokens_details: z3.object({
438
+ cached_tokens: z3.number().nullish()
439
+ }).nullish(),
440
+ completion_tokens_details: z3.object({
441
+ reasoning_tokens: z3.number().nullish()
442
+ }).nullish()
443
+ }).nullish();
444
+ }
445
+ var tokenUsageSchema;
446
+ function getTokenUsageSchema() {
447
+ return tokenUsageSchema != null ? tokenUsageSchema : tokenUsageSchema = createTokenUsageSchema();
448
+ }
449
+ function createDeepSeekErrorSchema() {
450
+ return z3.object({
451
+ error: z3.object({
452
+ message: z3.string(),
453
+ type: z3.string().nullish(),
454
+ param: z3.any().nullish(),
455
+ code: z3.union([z3.string(), z3.number()]).nullish()
418
456
  })
419
- )
420
- });
421
- var deepseekChatLogprobsSchema = z3.object({
422
- content: z3.array(deepseekChatLogprobSchema).nullish(),
423
- reasoning_content: z3.array(deepseekChatLogprobSchema).nullish()
424
- }).nullish();
425
- var deepseekChatResponseSchema = z3.object({
426
- id: z3.string().nullish(),
427
- created: z3.number().nullish(),
428
- model: z3.string().nullish(),
429
- object: z3.literal("chat.completion").nullish(),
430
- system_fingerprint: z3.string().nullish(),
431
- choices: z3.array(
457
+ });
458
+ }
459
+ var errorSchema;
460
+ function getDeepSeekErrorSchema() {
461
+ return errorSchema != null ? errorSchema : errorSchema = createDeepSeekErrorSchema();
462
+ }
463
+ var deepSeekErrorSchema = lazySchema3(
464
+ () => zodSchema3(getDeepSeekErrorSchema())
465
+ );
466
+ function createDeepseekChatLogprobsSchema() {
467
+ const deepseekChatLogprobSchema = z3.object({
468
+ token: z3.string(),
469
+ logprob: z3.number(),
470
+ bytes: z3.array(z3.number()).nullable(),
471
+ top_logprobs: z3.array(
472
+ z3.object({
473
+ token: z3.string(),
474
+ logprob: z3.number(),
475
+ bytes: z3.array(z3.number()).nullable()
476
+ })
477
+ )
478
+ });
479
+ return z3.object({
480
+ content: z3.array(deepseekChatLogprobSchema).nullish(),
481
+ reasoning_content: z3.array(deepseekChatLogprobSchema).nullish()
482
+ }).nullish();
483
+ }
484
+ var logprobsSchema;
485
+ function getDeepseekChatLogprobsSchema() {
486
+ return logprobsSchema != null ? logprobsSchema : logprobsSchema = createDeepseekChatLogprobsSchema();
487
+ }
488
+ var deepseekChatResponseSchema = lazySchema3(
489
+ () => zodSchema3(
432
490
  z3.object({
433
- index: z3.number().nullish(),
434
- message: z3.object({
435
- role: z3.literal("assistant").nullish(),
436
- content: z3.string().nullish(),
437
- reasoning_content: z3.string().nullish(),
438
- tool_calls: z3.array(
439
- z3.object({
440
- id: z3.string().nullish(),
441
- type: z3.literal("function").nullish(),
442
- function: z3.object({
443
- name: z3.string(),
444
- arguments: z3.string()
445
- })
446
- })
447
- ).nullish()
448
- }),
449
- logprobs: deepseekChatLogprobsSchema,
450
- finish_reason: z3.string().nullish()
491
+ id: z3.string().nullish(),
492
+ created: z3.number().nullish(),
493
+ model: z3.string().nullish(),
494
+ object: z3.literal("chat.completion").nullish(),
495
+ system_fingerprint: z3.string().nullish(),
496
+ choices: z3.array(
497
+ z3.object({
498
+ index: z3.number().nullish(),
499
+ message: z3.object({
500
+ role: z3.literal("assistant").nullish(),
501
+ content: z3.string().nullish(),
502
+ reasoning_content: z3.string().nullish(),
503
+ tool_calls: z3.array(
504
+ z3.object({
505
+ id: z3.string().nullish(),
506
+ type: z3.literal("function").nullish(),
507
+ function: z3.object({
508
+ name: z3.string(),
509
+ arguments: z3.string()
510
+ })
511
+ })
512
+ ).nullish()
513
+ }),
514
+ logprobs: getDeepseekChatLogprobsSchema(),
515
+ finish_reason: z3.string().nullish()
516
+ })
517
+ ),
518
+ usage: getTokenUsageSchema()
451
519
  })
452
- ),
453
- usage: tokenUsageSchema
454
- });
455
- var deepseekChatChunkSchema = lazySchema(
456
- () => zodSchema(
520
+ )
521
+ );
522
+ var deepseekChatChunkSchema = lazySchema3(
523
+ () => zodSchema3(
457
524
  z3.union([
458
525
  z3.object({
459
526
  id: z3.string().nullish(),
@@ -480,13 +547,13 @@ var deepseekChatChunkSchema = lazySchema(
480
547
  })
481
548
  ).nullish()
482
549
  }).nullish(),
483
- logprobs: deepseekChatLogprobsSchema,
550
+ logprobs: getDeepseekChatLogprobsSchema(),
484
551
  finish_reason: z3.string().nullish()
485
552
  })
486
553
  ),
487
- usage: tokenUsageSchema
554
+ usage: getTokenUsageSchema()
488
555
  }),
489
- deepSeekErrorSchema
556
+ getDeepSeekErrorSchema()
490
557
  ])
491
558
  )
492
559
  );
@@ -1107,10 +1174,15 @@ var DeepSeekChatLanguageModel = class {
1107
1174
  };
1108
1175
  }
1109
1176
  };
1177
+
1178
+ // src/internal/index.ts
1179
+ var deepseekChatOptions2 = getDeepseekChatOptionsSchema();
1180
+ var deepseekMessageProviderOptions2 = getDeepseekMessageOptionsSchema();
1181
+ var deepseekAssistantMessageProviderOptions2 = getDeepseekAssistantMessageOptionsSchema();
1110
1182
  export {
1111
1183
  DeepSeekChatLanguageModel,
1112
- deepseekAssistantMessageProviderOptions,
1113
- deepseekChatOptions,
1114
- deepseekMessageProviderOptions
1184
+ deepseekAssistantMessageProviderOptions2 as deepseekAssistantMessageProviderOptions,
1185
+ deepseekChatOptions2 as deepseekChatOptions,
1186
+ deepseekMessageProviderOptions2 as deepseekMessageProviderOptions
1115
1187
  };
1116
1188
  //# sourceMappingURL=index.mjs.map