@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.
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 import_provider_utils4 = require("@ai-sdk/provider-utils");
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 import_provider_utils3 = require("@ai-sdk/provider-utils");
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 import_provider_utils = require("@ai-sdk/provider-utils");
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
- var deepseekChatOptions = import_v4.z.object({
44
- /**
45
- * Whether to return log probabilities for generated tokens.
46
- */
47
- logprobs: import_v4.z.boolean().optional(),
48
- /**
49
- * Number of most likely tokens to return at each token position.
50
- *
51
- * Setting this option automatically enables `logprobs`.
52
- */
53
- topLogprobs: import_v4.z.number().int().min(0).max(20).optional(),
54
- /**
55
- * An opaque identifier for the end user. DeepSeek uses this identifier for
56
- * content-safety tracing and request isolation.
57
- *
58
- * Must contain only ASCII letters, numbers, underscores, and hyphens, and
59
- * must be at most 512 characters long.
60
- */
61
- 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(),
62
- /**
63
- * Type of thinking to use. Defaults to `enabled`.
64
- */
65
- thinking: import_v4.z.object({
66
- // `adaptive` is accepted at runtime for backwards compatibility and
67
- // mapped to `enabled`, but is intentionally excluded from the exported
68
- // provider options type.
69
- type: import_v4.z.enum(["adaptive", "enabled", "disabled"]).optional()
70
- }).optional(),
71
- /**
72
- * Controls the thinking strength for DeepSeek V4 reasoning models.
73
- */
74
- // `medium` and `xhigh` are accepted at runtime for backwards compatibility
75
- // and mapped to canonical DeepSeek values, but are intentionally excluded
76
- // from the exported provider options type.
77
- reasoningEffort: import_v4.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
78
- /**
79
- * Whether to use strict JSON schema validation for structured outputs.
80
- * Only applies when the serving endpoint supports JSON schema response
81
- * formats (e.g. Azure). Defaults to `true`.
82
- */
83
- strictJsonSchema: import_v4.z.boolean().optional()
84
- });
85
- var deepseekMessageProviderOptions = import_v4.z.object({
86
- /**
87
- * The name of the participant represented by the message.
88
- *
89
- * Supported on system, user, and assistant messages.
90
- */
91
- name: import_v4.z.string().optional()
92
- });
93
- var deepseekAssistantMessageProviderOptions = deepseekMessageProviderOptions.extend({
94
- /**
95
- * Whether the assistant message content is a prefix that DeepSeek should
96
- * continue. This beta feature is only supported on the final assistant
97
- * message when using a beta base URL.
98
- */
99
- prefix: import_v4.z.literal(true).optional()
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 deepseekChatOptions = (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 = import_v42.z.object({
105
- /**
106
- * Controls how DeepSeek processes an image sent as an `image_url` part.
107
- *
108
- * @see https://api-docs.deepseek.com/api/create-chat-completion/
109
- */
110
- imageDetail: import_v42.z.enum(["low", "high", "original", "auto"]).optional(),
111
- /**
112
- * Sends inline image data as a DeepSeek `file` part using `file_data`
113
- * instead of an `image_url` data URL. When set, the file part's filename
114
- * is preserved.
115
- *
116
- * This option only applies to inline image data. It cannot be combined
117
- * with `imageDetail`.
118
- */
119
- fileData: import_v42.z.literal(true).optional()
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) {
@@ -168,7 +201,7 @@ async function convertToDeepSeekChatMessages({
168
201
  let index = -1;
169
202
  for (const { role, content, providerOptions } of prompt) {
170
203
  index++;
171
- const deepseekMessageOptions = await (0, import_provider_utils.parseProviderOptions)({
204
+ const deepseekMessageOptions = await (0, import_provider_utils3.parseProviderOptions)({
172
205
  provider: providerOptionsName,
173
206
  providerOptions,
174
207
  schema: deepseekAssistantMessageProviderOptions
@@ -220,7 +253,7 @@ async function convertToDeepSeekChatMessages({
220
253
  if (part.type === "text") {
221
254
  userContent.push({ type: "text", text: part.text });
222
255
  } else if (part.type === "file" && (part.mediaType === "image" || part.mediaType.startsWith("image/"))) {
223
- const filePartOptions = await (0, import_provider_utils.parseProviderOptions)({
256
+ const filePartOptions = await (0, import_provider_utils3.parseProviderOptions)({
224
257
  provider: providerOptionsName,
225
258
  providerOptions: part.providerOptions,
226
259
  schema: deepseekFilePartProviderOptions
@@ -256,7 +289,7 @@ async function convertToDeepSeekChatMessages({
256
289
  }
257
290
  });
258
291
  } else {
259
- const dataUrl = `data:${resolvedMediaType === "image/jpg" ? "image/jpeg" : resolvedMediaType};base64,${(0, import_provider_utils.convertToBase64)(part.data)}`;
292
+ const dataUrl = `data:${resolvedMediaType === "image/jpg" ? "image/jpeg" : resolvedMediaType};base64,${(0, import_provider_utils3.convertToBase64)(part.data)}`;
260
293
  if ((filePartOptions == null ? void 0 : filePartOptions.fileData) === true) {
261
294
  if (filePartOptions.imageDetail != null) {
262
295
  throw new import_provider.InvalidPromptError({
@@ -401,77 +434,102 @@ async function convertToDeepSeekChatMessages({
401
434
  }
402
435
 
403
436
  // src/chat/deepseek-chat-api-types.ts
404
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
437
+ var import_provider_utils4 = require("@ai-sdk/provider-utils");
405
438
  var import_v43 = require("zod/v4");
406
- var tokenUsageSchema = import_v43.z.object({
407
- prompt_tokens: import_v43.z.number().nullish(),
408
- completion_tokens: import_v43.z.number().nullish(),
409
- prompt_cache_hit_tokens: import_v43.z.number().nullish(),
410
- prompt_cache_miss_tokens: import_v43.z.number().nullish(),
411
- total_tokens: import_v43.z.number().nullish(),
412
- prompt_tokens_details: import_v43.z.object({
413
- cached_tokens: import_v43.z.number().nullish()
414
- }).nullish(),
415
- completion_tokens_details: import_v43.z.object({
416
- reasoning_tokens: import_v43.z.number().nullish()
417
- }).nullish()
418
- }).nullish();
419
- var deepSeekErrorSchema = import_v43.z.object({
420
- error: import_v43.z.object({
421
- message: import_v43.z.string(),
422
- type: import_v43.z.string().nullish(),
423
- param: import_v43.z.any().nullish(),
424
- code: import_v43.z.union([import_v43.z.string(), import_v43.z.number()]).nullish()
425
- })
426
- });
427
- var deepseekChatLogprobSchema = import_v43.z.object({
428
- token: import_v43.z.string(),
429
- logprob: import_v43.z.number(),
430
- bytes: import_v43.z.array(import_v43.z.number()).nullable(),
431
- top_logprobs: import_v43.z.array(
432
- import_v43.z.object({
433
- token: import_v43.z.string(),
434
- logprob: import_v43.z.number(),
435
- bytes: import_v43.z.array(import_v43.z.number()).nullable()
439
+ function createTokenUsageSchema() {
440
+ return import_v43.z.object({
441
+ prompt_tokens: import_v43.z.number().nullish(),
442
+ completion_tokens: import_v43.z.number().nullish(),
443
+ prompt_cache_hit_tokens: import_v43.z.number().nullish(),
444
+ prompt_cache_miss_tokens: import_v43.z.number().nullish(),
445
+ total_tokens: import_v43.z.number().nullish(),
446
+ prompt_tokens_details: import_v43.z.object({
447
+ cached_tokens: import_v43.z.number().nullish()
448
+ }).nullish(),
449
+ completion_tokens_details: import_v43.z.object({
450
+ reasoning_tokens: import_v43.z.number().nullish()
451
+ }).nullish()
452
+ }).nullish();
453
+ }
454
+ var tokenUsageSchema;
455
+ function getTokenUsageSchema() {
456
+ return tokenUsageSchema != null ? tokenUsageSchema : tokenUsageSchema = createTokenUsageSchema();
457
+ }
458
+ function createDeepSeekErrorSchema() {
459
+ return import_v43.z.object({
460
+ error: import_v43.z.object({
461
+ message: import_v43.z.string(),
462
+ type: import_v43.z.string().nullish(),
463
+ param: import_v43.z.any().nullish(),
464
+ code: import_v43.z.union([import_v43.z.string(), import_v43.z.number()]).nullish()
436
465
  })
437
- )
438
- });
439
- var deepseekChatLogprobsSchema = import_v43.z.object({
440
- content: import_v43.z.array(deepseekChatLogprobSchema).nullish(),
441
- reasoning_content: import_v43.z.array(deepseekChatLogprobSchema).nullish()
442
- }).nullish();
443
- var deepseekChatResponseSchema = import_v43.z.object({
444
- id: import_v43.z.string().nullish(),
445
- created: import_v43.z.number().nullish(),
446
- model: import_v43.z.string().nullish(),
447
- object: import_v43.z.literal("chat.completion").nullish(),
448
- system_fingerprint: import_v43.z.string().nullish(),
449
- choices: import_v43.z.array(
466
+ });
467
+ }
468
+ var errorSchema;
469
+ function getDeepSeekErrorSchema() {
470
+ return errorSchema != null ? errorSchema : errorSchema = createDeepSeekErrorSchema();
471
+ }
472
+ var deepSeekErrorSchema = (0, import_provider_utils4.lazySchema)(
473
+ () => (0, import_provider_utils4.zodSchema)(getDeepSeekErrorSchema())
474
+ );
475
+ function createDeepseekChatLogprobsSchema() {
476
+ const deepseekChatLogprobSchema = import_v43.z.object({
477
+ token: import_v43.z.string(),
478
+ logprob: import_v43.z.number(),
479
+ bytes: import_v43.z.array(import_v43.z.number()).nullable(),
480
+ top_logprobs: import_v43.z.array(
481
+ import_v43.z.object({
482
+ token: import_v43.z.string(),
483
+ logprob: import_v43.z.number(),
484
+ bytes: import_v43.z.array(import_v43.z.number()).nullable()
485
+ })
486
+ )
487
+ });
488
+ return import_v43.z.object({
489
+ content: import_v43.z.array(deepseekChatLogprobSchema).nullish(),
490
+ reasoning_content: import_v43.z.array(deepseekChatLogprobSchema).nullish()
491
+ }).nullish();
492
+ }
493
+ var logprobsSchema;
494
+ function getDeepseekChatLogprobsSchema() {
495
+ return logprobsSchema != null ? logprobsSchema : logprobsSchema = createDeepseekChatLogprobsSchema();
496
+ }
497
+ var deepseekChatResponseSchema = (0, import_provider_utils4.lazySchema)(
498
+ () => (0, import_provider_utils4.zodSchema)(
450
499
  import_v43.z.object({
451
- index: import_v43.z.number().nullish(),
452
- message: import_v43.z.object({
453
- role: import_v43.z.literal("assistant").nullish(),
454
- content: import_v43.z.string().nullish(),
455
- reasoning_content: import_v43.z.string().nullish(),
456
- tool_calls: import_v43.z.array(
457
- import_v43.z.object({
458
- id: import_v43.z.string().nullish(),
459
- type: import_v43.z.literal("function").nullish(),
460
- function: import_v43.z.object({
461
- name: import_v43.z.string(),
462
- arguments: import_v43.z.string()
463
- })
464
- })
465
- ).nullish()
466
- }),
467
- logprobs: deepseekChatLogprobsSchema,
468
- finish_reason: import_v43.z.string().nullish()
500
+ id: import_v43.z.string().nullish(),
501
+ created: import_v43.z.number().nullish(),
502
+ model: import_v43.z.string().nullish(),
503
+ object: import_v43.z.literal("chat.completion").nullish(),
504
+ system_fingerprint: import_v43.z.string().nullish(),
505
+ choices: import_v43.z.array(
506
+ import_v43.z.object({
507
+ index: import_v43.z.number().nullish(),
508
+ message: import_v43.z.object({
509
+ role: import_v43.z.literal("assistant").nullish(),
510
+ content: import_v43.z.string().nullish(),
511
+ reasoning_content: import_v43.z.string().nullish(),
512
+ tool_calls: import_v43.z.array(
513
+ import_v43.z.object({
514
+ id: import_v43.z.string().nullish(),
515
+ type: import_v43.z.literal("function").nullish(),
516
+ function: import_v43.z.object({
517
+ name: import_v43.z.string(),
518
+ arguments: import_v43.z.string()
519
+ })
520
+ })
521
+ ).nullish()
522
+ }),
523
+ logprobs: getDeepseekChatLogprobsSchema(),
524
+ finish_reason: import_v43.z.string().nullish()
525
+ })
526
+ ),
527
+ usage: getTokenUsageSchema()
469
528
  })
470
- ),
471
- usage: tokenUsageSchema
472
- });
473
- var deepseekChatChunkSchema = (0, import_provider_utils2.lazySchema)(
474
- () => (0, import_provider_utils2.zodSchema)(
529
+ )
530
+ );
531
+ var deepseekChatChunkSchema = (0, import_provider_utils4.lazySchema)(
532
+ () => (0, import_provider_utils4.zodSchema)(
475
533
  import_v43.z.union([
476
534
  import_v43.z.object({
477
535
  id: import_v43.z.string().nullish(),
@@ -498,13 +556,13 @@ var deepseekChatChunkSchema = (0, import_provider_utils2.lazySchema)(
498
556
  })
499
557
  ).nullish()
500
558
  }).nullish(),
501
- logprobs: deepseekChatLogprobsSchema,
559
+ logprobs: getDeepseekChatLogprobsSchema(),
502
560
  finish_reason: import_v43.z.string().nullish()
503
561
  })
504
562
  ),
505
- usage: tokenUsageSchema
563
+ usage: getTokenUsageSchema()
506
564
  }),
507
- deepSeekErrorSchema
565
+ getDeepSeekErrorSchema()
508
566
  ])
509
567
  )
510
568
  );
@@ -622,7 +680,7 @@ var DeepSeekChatLanguageModel = class {
622
680
  };
623
681
  this.modelId = modelId;
624
682
  this.config = config;
625
- this.failedResponseHandler = (0, import_provider_utils3.createJsonErrorResponseHandler)({
683
+ this.failedResponseHandler = (0, import_provider_utils5.createJsonErrorResponseHandler)({
626
684
  errorSchema: deepSeekErrorSchema,
627
685
  errorToMessage: (error) => error.error.message
628
686
  });
@@ -649,7 +707,7 @@ var DeepSeekChatLanguageModel = class {
649
707
  seed
650
708
  }) {
651
709
  var _a, _b, _c, _d;
652
- const deepseekOptions = (_a = await (0, import_provider_utils3.parseProviderOptions)({
710
+ const deepseekOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
653
711
  provider: this.providerOptionsName,
654
712
  providerOptions,
655
713
  schema: deepseekChatOptions
@@ -762,15 +820,15 @@ var DeepSeekChatLanguageModel = class {
762
820
  responseHeaders,
763
821
  value: responseBody,
764
822
  rawValue: rawResponse
765
- } = await (0, import_provider_utils3.postJsonToApi)({
823
+ } = await (0, import_provider_utils5.postJsonToApi)({
766
824
  url: this.config.url({
767
825
  path: "/chat/completions",
768
826
  modelId: this.modelId
769
827
  }),
770
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
828
+ headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
771
829
  body: args,
772
830
  failedResponseHandler: this.failedResponseHandler,
773
- successfulResponseHandler: (0, import_provider_utils3.createJsonResponseHandler)(
831
+ successfulResponseHandler: (0, import_provider_utils5.createJsonResponseHandler)(
774
832
  deepseekChatResponseSchema
775
833
  ),
776
834
  abortSignal: options.abortSignal,
@@ -789,7 +847,7 @@ var DeepSeekChatLanguageModel = class {
789
847
  for (const toolCall of choice.message.tool_calls) {
790
848
  content.push({
791
849
  type: "tool-call",
792
- toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils3.generateId)(),
850
+ toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils5.generateId)(),
793
851
  toolName: toolCall.function.name,
794
852
  input: toolCall.function.arguments
795
853
  });
@@ -846,15 +904,15 @@ var DeepSeekChatLanguageModel = class {
846
904
  stream: true,
847
905
  stream_options: { include_usage: true }
848
906
  };
849
- const { responseHeaders, value: response } = await (0, import_provider_utils3.postJsonToApi)({
907
+ const { responseHeaders, value: response } = await (0, import_provider_utils5.postJsonToApi)({
850
908
  url: this.config.url({
851
909
  path: "/chat/completions",
852
910
  modelId: this.modelId
853
911
  }),
854
- headers: (0, import_provider_utils3.combineHeaders)(this.config.headers(), options.headers),
912
+ headers: (0, import_provider_utils5.combineHeaders)(this.config.headers(), options.headers),
855
913
  body,
856
914
  failedResponseHandler: this.failedResponseHandler,
857
- successfulResponseHandler: (0, import_provider_utils3.createEventSourceResponseHandler)(
915
+ successfulResponseHandler: (0, import_provider_utils5.createEventSourceResponseHandler)(
858
916
  deepseekChatChunkSchema
859
917
  ),
860
918
  abortSignal: options.abortSignal,
@@ -1014,14 +1072,14 @@ var DeepSeekChatLanguageModel = class {
1014
1072
  delta: toolCall2.function.arguments
1015
1073
  });
1016
1074
  }
1017
- if ((0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) {
1075
+ if ((0, import_provider_utils5.isParsableJson)(toolCall2.function.arguments)) {
1018
1076
  controller.enqueue({
1019
1077
  type: "tool-input-end",
1020
1078
  id: toolCall2.id
1021
1079
  });
1022
1080
  controller.enqueue({
1023
1081
  type: "tool-call",
1024
- toolCallId: (_g = toolCall2.id) != null ? _g : (0, import_provider_utils3.generateId)(),
1082
+ toolCallId: (_g = toolCall2.id) != null ? _g : (0, import_provider_utils5.generateId)(),
1025
1083
  toolName: toolCall2.function.name,
1026
1084
  input: toolCall2.function.arguments
1027
1085
  });
@@ -1042,14 +1100,14 @@ var DeepSeekChatLanguageModel = class {
1042
1100
  id: toolCall.id,
1043
1101
  delta: (_k = toolCallDelta.function.arguments) != null ? _k : ""
1044
1102
  });
1045
- if (((_l = toolCall.function) == null ? void 0 : _l.name) != null && ((_m = toolCall.function) == null ? void 0 : _m.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall.function.arguments)) {
1103
+ if (((_l = toolCall.function) == null ? void 0 : _l.name) != null && ((_m = toolCall.function) == null ? void 0 : _m.arguments) != null && (0, import_provider_utils5.isParsableJson)(toolCall.function.arguments)) {
1046
1104
  controller.enqueue({
1047
1105
  type: "tool-input-end",
1048
1106
  id: toolCall.id
1049
1107
  });
1050
1108
  controller.enqueue({
1051
1109
  type: "tool-call",
1052
- toolCallId: (_n = toolCall.id) != null ? _n : (0, import_provider_utils3.generateId)(),
1110
+ toolCallId: (_n = toolCall.id) != null ? _n : (0, import_provider_utils5.generateId)(),
1053
1111
  toolName: toolCall.function.name,
1054
1112
  input: toolCall.function.arguments
1055
1113
  });
@@ -1075,7 +1133,7 @@ var DeepSeekChatLanguageModel = class {
1075
1133
  });
1076
1134
  controller.enqueue({
1077
1135
  type: "tool-call",
1078
- toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils3.generateId)(),
1136
+ toolCallId: (_a = toolCall.id) != null ? _a : (0, import_provider_utils5.generateId)(),
1079
1137
  toolName: toolCall.function.name,
1080
1138
  input: toolCall.function.arguments
1081
1139
  });
@@ -1125,15 +1183,15 @@ var DeepSeekChatLanguageModel = class {
1125
1183
  };
1126
1184
 
1127
1185
  // src/version.ts
1128
- var VERSION = true ? "1.0.63" : "0.0.0-test";
1186
+ var VERSION = true ? "1.0.64" : "0.0.0-test";
1129
1187
 
1130
1188
  // src/deepseek-provider.ts
1131
1189
  function createDeepSeek(options = {}) {
1132
1190
  var _a;
1133
- const baseURL = (_a = (0, import_provider_utils4.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.deepseek.com";
1134
- const getHeaders = () => (0, import_provider_utils4.withUserAgentSuffix)(
1191
+ const baseURL = (_a = (0, import_provider_utils6.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.deepseek.com";
1192
+ const getHeaders = () => (0, import_provider_utils6.withUserAgentSuffix)(
1135
1193
  {
1136
- Authorization: `Bearer ${(0, import_provider_utils4.loadApiKey)({
1194
+ Authorization: `Bearer ${(0, import_provider_utils6.loadApiKey)({
1137
1195
  apiKey: options.apiKey,
1138
1196
  environmentVariableName: "DEEPSEEK_API_KEY",
1139
1197
  description: "DeepSeek API key"