@deepstrike/sdk 0.2.3 → 0.2.4
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/providers/deepseek.js +13 -1
- package/package.json +2 -2
|
@@ -35,17 +35,27 @@ export class DeepSeekProvider extends OpenAIChatProvider {
|
|
|
35
35
|
let finalText = "";
|
|
36
36
|
const stream = await this.client.chat.completions.create({
|
|
37
37
|
...omitExtensionKeys(extensions, [
|
|
38
|
-
"model", "messages", "tools", "stream", "extra_body", "reasoning_effort",
|
|
38
|
+
"model", "messages", "tools", "stream", "stream_options", "extra_body", "reasoning_effort",
|
|
39
39
|
"exposeReasoning", "thinking", "reasoningEffort",
|
|
40
40
|
]),
|
|
41
41
|
model: this.model,
|
|
42
42
|
messages: msgs,
|
|
43
43
|
...(tools.length ? { tools: this.chat.buildTools(tools) } : {}),
|
|
44
44
|
stream: true,
|
|
45
|
+
stream_options: { include_usage: true },
|
|
45
46
|
reasoning_effort: reasoningEffort,
|
|
46
47
|
extra_body: { thinking: { type: thinking } },
|
|
47
48
|
});
|
|
49
|
+
let totalTokens = 0;
|
|
50
|
+
let inputTokens = 0;
|
|
51
|
+
let outputTokens = 0;
|
|
48
52
|
for await (const chunk of stream) {
|
|
53
|
+
if (chunk.usage) {
|
|
54
|
+
totalTokens = chunk.usage.total_tokens;
|
|
55
|
+
inputTokens = chunk.usage.prompt_tokens ?? 0;
|
|
56
|
+
outputTokens = chunk.usage.completion_tokens ?? 0;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
49
59
|
const choice = chunk.choices[0];
|
|
50
60
|
if (!choice)
|
|
51
61
|
continue;
|
|
@@ -110,5 +120,7 @@ export class DeepSeekProvider extends OpenAIChatProvider {
|
|
|
110
120
|
emittedToolCallIndexes.add(idx);
|
|
111
121
|
yield { type: "tool_call", id: tb.id, name: tb.name, arguments: args };
|
|
112
122
|
}
|
|
123
|
+
if (totalTokens > 0)
|
|
124
|
+
yield { type: "usage", totalTokens, inputTokens, outputTokens };
|
|
113
125
|
}
|
|
114
126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepstrike/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "DeepStrike Node.js SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@anthropic-ai/sdk": "^0.99.0",
|
|
23
|
-
"@deepstrike/core": "0.2.
|
|
23
|
+
"@deepstrike/core": "0.2.4",
|
|
24
24
|
"@google/generative-ai": "^0.24.1",
|
|
25
25
|
"openai": "^5.23.2"
|
|
26
26
|
},
|