@kernl-sdk/openai 0.3.2 → 0.4.0
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/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @kernl-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8815744: **BREAKING:** Refactor event kind naming from kebab-case to dot notation
|
|
8
|
+
|
|
9
|
+
This aligns the language model stream/item kinds with the existing realtime events naming convention.
|
|
10
|
+
|
|
11
|
+
### Kind value changes
|
|
12
|
+
|
|
13
|
+
| Old | New |
|
|
14
|
+
| ------------------ | ------------------ |
|
|
15
|
+
| `tool-call` | `tool.call` |
|
|
16
|
+
| `tool-result` | `tool.result` |
|
|
17
|
+
| `text-start` | `text.start` |
|
|
18
|
+
| `text-delta` | `text.delta` |
|
|
19
|
+
| `text-end` | `text.end` |
|
|
20
|
+
| `reasoning-start` | `reasoning.start` |
|
|
21
|
+
| `reasoning-delta` | `reasoning.delta` |
|
|
22
|
+
| `reasoning-end` | `reasoning.end` |
|
|
23
|
+
| `tool-input-start` | `tool.input.start` |
|
|
24
|
+
| `tool-input-delta` | `tool.input.delta` |
|
|
25
|
+
| `tool-input-end` | `tool.input.end` |
|
|
26
|
+
| `stream-start` | `stream.start` |
|
|
27
|
+
|
|
28
|
+
### ToolInputStartEvent: `toolName` → `toolId`
|
|
29
|
+
|
|
30
|
+
The `ToolInputStartEvent` now uses `toolId` to match `ToolCall` and `ToolResult`.
|
|
31
|
+
|
|
32
|
+
### Migration
|
|
33
|
+
|
|
34
|
+
If you have persisted thread events, run:
|
|
35
|
+
|
|
36
|
+
```sql
|
|
37
|
+
UPDATE thread_events SET kind = 'tool.call' WHERE kind = 'tool-call';
|
|
38
|
+
UPDATE thread_events SET kind = 'tool.result' WHERE kind = 'tool-result';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [8815744]
|
|
44
|
+
- @kernl-sdk/protocol@0.5.0
|
|
45
|
+
|
|
3
46
|
## 0.3.2
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -165,7 +165,7 @@ describe("ITEM codec", () => {
|
|
|
165
165
|
});
|
|
166
166
|
it("should encode tool call", () => {
|
|
167
167
|
const result = ITEM.encode({
|
|
168
|
-
kind: "tool
|
|
168
|
+
kind: "tool.call",
|
|
169
169
|
callId: "call-1",
|
|
170
170
|
toolId: "get_weather",
|
|
171
171
|
state: "completed",
|
|
@@ -180,7 +180,7 @@ describe("ITEM codec", () => {
|
|
|
180
180
|
});
|
|
181
181
|
it("should encode tool result", () => {
|
|
182
182
|
const result = ITEM.encode({
|
|
183
|
-
kind: "tool
|
|
183
|
+
kind: "tool.result",
|
|
184
184
|
callId: "call-1",
|
|
185
185
|
toolId: "get_weather",
|
|
186
186
|
state: "completed",
|
|
@@ -195,7 +195,7 @@ describe("ITEM codec", () => {
|
|
|
195
195
|
});
|
|
196
196
|
it("should encode tool result with error", () => {
|
|
197
197
|
const result = ITEM.encode({
|
|
198
|
-
kind: "tool
|
|
198
|
+
kind: "tool.result",
|
|
199
199
|
callId: "call-1",
|
|
200
200
|
toolId: "get_weather",
|
|
201
201
|
state: "completed",
|
|
@@ -230,7 +230,7 @@ describe("ITEM codec", () => {
|
|
|
230
230
|
arguments: '{"city": "NYC"}',
|
|
231
231
|
});
|
|
232
232
|
expect(result).toEqual({
|
|
233
|
-
kind: "tool
|
|
233
|
+
kind: "tool.call",
|
|
234
234
|
callId: "call-1",
|
|
235
235
|
toolId: "get_weather",
|
|
236
236
|
state: "completed",
|
|
@@ -244,7 +244,7 @@ describe("ITEM codec", () => {
|
|
|
244
244
|
output: '{"temp": 72}',
|
|
245
245
|
});
|
|
246
246
|
expect(result).toEqual({
|
|
247
|
-
kind: "tool
|
|
247
|
+
kind: "tool.result",
|
|
248
248
|
callId: "call-1",
|
|
249
249
|
toolId: "",
|
|
250
250
|
state: "completed",
|
|
@@ -98,14 +98,14 @@ export const ITEM = {
|
|
|
98
98
|
});
|
|
99
99
|
return { type: "message", role: item.role, content };
|
|
100
100
|
}
|
|
101
|
-
case "tool
|
|
101
|
+
case "tool.call":
|
|
102
102
|
return {
|
|
103
103
|
type: "function_call",
|
|
104
104
|
call_id: item.callId,
|
|
105
105
|
name: item.toolId,
|
|
106
106
|
arguments: item.arguments,
|
|
107
107
|
};
|
|
108
|
-
case "tool
|
|
108
|
+
case "tool.result":
|
|
109
109
|
return {
|
|
110
110
|
type: "function_call_output",
|
|
111
111
|
call_id: item.callId,
|
|
@@ -132,7 +132,7 @@ export const ITEM = {
|
|
|
132
132
|
};
|
|
133
133
|
case "function_call":
|
|
134
134
|
return {
|
|
135
|
-
kind: "tool
|
|
135
|
+
kind: "tool.call",
|
|
136
136
|
callId: item.call_id,
|
|
137
137
|
toolId: item.name,
|
|
138
138
|
state: "completed",
|
|
@@ -140,7 +140,7 @@ export const ITEM = {
|
|
|
140
140
|
};
|
|
141
141
|
case "function_call_output":
|
|
142
142
|
return {
|
|
143
|
-
kind: "tool
|
|
143
|
+
kind: "tool.result",
|
|
144
144
|
callId: item.call_id,
|
|
145
145
|
toolId: "",
|
|
146
146
|
state: "completed",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernl-sdk/openai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "OpenAI provider for kernl",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kernl",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ws": "^8.18.0",
|
|
35
|
-
"@kernl-sdk/protocol": "0.
|
|
35
|
+
"@kernl-sdk/protocol": "0.5.0",
|
|
36
36
|
"@kernl-sdk/shared": "0.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -193,7 +193,7 @@ describe("ITEM codec", () => {
|
|
|
193
193
|
|
|
194
194
|
it("should encode tool call", () => {
|
|
195
195
|
const result = ITEM.encode({
|
|
196
|
-
kind: "tool
|
|
196
|
+
kind: "tool.call",
|
|
197
197
|
callId: "call-1",
|
|
198
198
|
toolId: "get_weather",
|
|
199
199
|
state: "completed",
|
|
@@ -210,7 +210,7 @@ describe("ITEM codec", () => {
|
|
|
210
210
|
|
|
211
211
|
it("should encode tool result", () => {
|
|
212
212
|
const result = ITEM.encode({
|
|
213
|
-
kind: "tool
|
|
213
|
+
kind: "tool.result",
|
|
214
214
|
callId: "call-1",
|
|
215
215
|
toolId: "get_weather",
|
|
216
216
|
state: "completed",
|
|
@@ -227,7 +227,7 @@ describe("ITEM codec", () => {
|
|
|
227
227
|
|
|
228
228
|
it("should encode tool result with error", () => {
|
|
229
229
|
const result = ITEM.encode({
|
|
230
|
-
kind: "tool
|
|
230
|
+
kind: "tool.result",
|
|
231
231
|
callId: "call-1",
|
|
232
232
|
toolId: "get_weather",
|
|
233
233
|
state: "completed",
|
|
@@ -267,7 +267,7 @@ describe("ITEM codec", () => {
|
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
expect(result).toEqual({
|
|
270
|
-
kind: "tool
|
|
270
|
+
kind: "tool.call",
|
|
271
271
|
callId: "call-1",
|
|
272
272
|
toolId: "get_weather",
|
|
273
273
|
state: "completed",
|
|
@@ -283,7 +283,7 @@ describe("ITEM codec", () => {
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
expect(result).toEqual({
|
|
286
|
-
kind: "tool
|
|
286
|
+
kind: "tool.result",
|
|
287
287
|
callId: "call-1",
|
|
288
288
|
toolId: "",
|
|
289
289
|
state: "completed",
|
|
@@ -124,7 +124,7 @@ export const ITEM: Codec<LanguageModelItem, OpenAIItem> = {
|
|
|
124
124
|
return { type: "message", role: item.role, content };
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
case "tool
|
|
127
|
+
case "tool.call":
|
|
128
128
|
return {
|
|
129
129
|
type: "function_call",
|
|
130
130
|
call_id: item.callId,
|
|
@@ -132,7 +132,7 @@ export const ITEM: Codec<LanguageModelItem, OpenAIItem> = {
|
|
|
132
132
|
arguments: item.arguments,
|
|
133
133
|
};
|
|
134
134
|
|
|
135
|
-
case "tool
|
|
135
|
+
case "tool.result":
|
|
136
136
|
return {
|
|
137
137
|
type: "function_call_output",
|
|
138
138
|
call_id: item.callId,
|
|
@@ -164,7 +164,7 @@ export const ITEM: Codec<LanguageModelItem, OpenAIItem> = {
|
|
|
164
164
|
|
|
165
165
|
case "function_call":
|
|
166
166
|
return {
|
|
167
|
-
kind: "tool
|
|
167
|
+
kind: "tool.call",
|
|
168
168
|
callId: item.call_id,
|
|
169
169
|
toolId: item.name,
|
|
170
170
|
state: "completed" as const,
|
|
@@ -173,7 +173,7 @@ export const ITEM: Codec<LanguageModelItem, OpenAIItem> = {
|
|
|
173
173
|
|
|
174
174
|
case "function_call_output":
|
|
175
175
|
return {
|
|
176
|
-
kind: "tool
|
|
176
|
+
kind: "tool.result",
|
|
177
177
|
callId: item.call_id,
|
|
178
178
|
toolId: "",
|
|
179
179
|
state: "completed" as const,
|