@alisio/plugin-deepseek 0.1.0-alpha.2 → 0.1.0-alpha.5
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/provider.js +44 -5
- package/package.json +3 -3
package/dist/provider.js
CHANGED
|
@@ -170,12 +170,23 @@ export class DeepSeekProvider {
|
|
|
170
170
|
if (choice.finish_reason)
|
|
171
171
|
finish = choice.finish_reason;
|
|
172
172
|
}
|
|
173
|
-
if (finish !== "stop" && finish !== "tool_calls")
|
|
173
|
+
if (finish !== "stop" && finish !== "tool_calls" && finish !== "length")
|
|
174
174
|
throw new Error(`Provider response incomplete: ${finish ?? "stream ended"}`);
|
|
175
175
|
const completed = [...calls.entries()].sort(([a], [b]) => a - b).map(([, c]) => c);
|
|
176
176
|
if (completed.some((c) => !c.id || !c.name))
|
|
177
177
|
throw new Error("Incomplete tool call");
|
|
178
|
-
|
|
178
|
+
if (finish === "length" && !text.trim())
|
|
179
|
+
throw new Error("Provider response cut off by max output tokens before any usable content; raise limits.maxOutputTokens");
|
|
180
|
+
yield {
|
|
181
|
+
type: "completed",
|
|
182
|
+
message: {
|
|
183
|
+
role: "assistant",
|
|
184
|
+
text,
|
|
185
|
+
calls: completed,
|
|
186
|
+
...(finish === "length" ? { truncated: true } : {}),
|
|
187
|
+
},
|
|
188
|
+
usage,
|
|
189
|
+
};
|
|
179
190
|
}
|
|
180
191
|
async *responses(request) {
|
|
181
192
|
const input = [];
|
|
@@ -231,10 +242,38 @@ export class DeepSeekProvider {
|
|
|
231
242
|
officialEvent.type === "response.reasoning_summary_text.delta") &&
|
|
232
243
|
typeof officialEvent.delta === "string")
|
|
233
244
|
yield { type: "reasoning_delta", delta: officialEvent.delta };
|
|
234
|
-
if (event.type === "response.failed" ||
|
|
235
|
-
event.type === "response.incomplete" ||
|
|
236
|
-
event.type === "error")
|
|
245
|
+
if (event.type === "response.failed" || event.type === "error")
|
|
237
246
|
throw new Error(`Provider response failed: ${event.type}`);
|
|
247
|
+
if (event.type === "response.incomplete") {
|
|
248
|
+
complete = true;
|
|
249
|
+
const r = event.response;
|
|
250
|
+
const calls = r.output
|
|
251
|
+
.filter((x) => x.type === "function_call")
|
|
252
|
+
.map((x) => ({ id: x.call_id, name: x.name, arguments: x.arguments }));
|
|
253
|
+
const text = r.output
|
|
254
|
+
.filter((x) => x.type === "message")
|
|
255
|
+
.flatMap((x) => x.content)
|
|
256
|
+
.filter((x) => x.type === "output_text")
|
|
257
|
+
.map((x) => x.text)
|
|
258
|
+
.join("");
|
|
259
|
+
if (!text.trim())
|
|
260
|
+
throw new Error("Provider response cut off by max output tokens before any usable content; raise limits.maxOutputTokens");
|
|
261
|
+
if (calls.some((c) => !c.id || !c.name))
|
|
262
|
+
throw new Error("Incomplete tool call");
|
|
263
|
+
yield {
|
|
264
|
+
type: "completed",
|
|
265
|
+
message: { role: "assistant", text, calls, providerData: r.output, truncated: true },
|
|
266
|
+
usage: r.usage
|
|
267
|
+
? {
|
|
268
|
+
input: r.usage.input_tokens,
|
|
269
|
+
output: r.usage.output_tokens,
|
|
270
|
+
...(typeof r.usage.input_tokens_details?.cached_tokens === "number"
|
|
271
|
+
? { cachedInput: r.usage.input_tokens_details.cached_tokens }
|
|
272
|
+
: {}),
|
|
273
|
+
}
|
|
274
|
+
: undefined,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
238
277
|
if (event.type === "response.completed") {
|
|
239
278
|
complete = true;
|
|
240
279
|
const r = event.response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alisio/plugin-deepseek",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
4
|
"description": "Built-in DeepSeek model provider for Alisio.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"openai": "7.23.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@alisio/sdk": "^0.1.0-alpha.
|
|
27
|
+
"@alisio/sdk": "^0.1.0-alpha.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@alisio/sdk": "0.1.0-alpha.
|
|
30
|
+
"@alisio/sdk": "0.1.0-alpha.5"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public",
|