@livekit/agents-plugin-openai 1.0.50 → 1.1.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/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/llm.cjs +8 -0
- package/dist/llm.cjs.map +1 -1
- package/dist/llm.d.cts +1 -0
- package/dist/llm.d.ts +1 -0
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +8 -0
- package/dist/llm.js.map +1 -1
- package/dist/llm.test.cjs +31 -16
- package/dist/llm.test.cjs.map +1 -1
- package/dist/llm.test.js +32 -17
- package/dist/llm.test.js.map +1 -1
- package/dist/realtime/api_proto.cjs.map +1 -1
- package/dist/realtime/api_proto.d.cts +7 -3
- package/dist/realtime/api_proto.d.ts +7 -3
- package/dist/realtime/api_proto.d.ts.map +1 -1
- package/dist/realtime/api_proto.js.map +1 -1
- package/dist/realtime/realtime_model.cjs +46 -22
- package/dist/realtime/realtime_model.cjs.map +1 -1
- package/dist/realtime/realtime_model.d.cts +2 -1
- package/dist/realtime/realtime_model.d.ts +2 -1
- package/dist/realtime/realtime_model.d.ts.map +1 -1
- package/dist/realtime/realtime_model.js +46 -22
- package/dist/realtime/realtime_model.js.map +1 -1
- package/dist/realtime/realtime_model.test.cjs +104 -14
- package/dist/realtime/realtime_model.test.cjs.map +1 -1
- package/dist/realtime/realtime_model.test.js +104 -14
- package/dist/realtime/realtime_model.test.js.map +1 -1
- package/dist/realtime/realtime_model_beta.cjs +40 -22
- package/dist/realtime/realtime_model_beta.cjs.map +1 -1
- package/dist/realtime/realtime_model_beta.d.ts.map +1 -1
- package/dist/realtime/realtime_model_beta.js +40 -22
- package/dist/realtime/realtime_model_beta.js.map +1 -1
- package/dist/responses/llm.cjs +71 -16
- package/dist/responses/llm.cjs.map +1 -1
- package/dist/responses/llm.d.cts +10 -25
- package/dist/responses/llm.d.ts +10 -25
- package/dist/responses/llm.d.ts.map +1 -1
- package/dist/responses/llm.js +71 -14
- package/dist/responses/llm.js.map +1 -1
- package/dist/responses/llm.test.cjs +32 -17
- package/dist/responses/llm.test.cjs.map +1 -1
- package/dist/responses/llm.test.js +33 -18
- package/dist/responses/llm.test.js.map +1 -1
- package/dist/stt.cjs +18 -3
- package/dist/stt.cjs.map +1 -1
- package/dist/stt.d.cts +2 -0
- package/dist/stt.d.ts +2 -0
- package/dist/stt.d.ts.map +1 -1
- package/dist/stt.js +19 -4
- package/dist/stt.js.map +1 -1
- package/dist/stt.test.cjs +11 -3
- package/dist/stt.test.cjs.map +1 -1
- package/dist/stt.test.js +12 -4
- package/dist/stt.test.js.map +1 -1
- package/dist/tts.cjs +11 -0
- package/dist/tts.cjs.map +1 -1
- package/dist/tts.d.cts +2 -0
- package/dist/tts.d.ts +2 -0
- package/dist/tts.d.ts.map +1 -1
- package/dist/tts.js +11 -0
- package/dist/tts.js.map +1 -1
- package/dist/tts.test.cjs +11 -3
- package/dist/tts.test.cjs.map +1 -1
- package/dist/tts.test.js +12 -4
- package/dist/tts.test.js.map +1 -1
- package/dist/ws/index.cjs +29 -0
- package/dist/ws/index.cjs.map +1 -0
- package/dist/ws/index.d.cts +3 -0
- package/dist/ws/index.d.ts +3 -0
- package/dist/ws/index.d.ts.map +1 -0
- package/dist/ws/index.js +5 -0
- package/dist/ws/index.js.map +1 -0
- package/dist/ws/llm.cjs +502 -0
- package/dist/ws/llm.cjs.map +1 -0
- package/dist/ws/llm.d.cts +74 -0
- package/dist/ws/llm.d.ts +74 -0
- package/dist/ws/llm.d.ts.map +1 -0
- package/dist/ws/llm.js +485 -0
- package/dist/ws/llm.js.map +1 -0
- package/dist/ws/llm.test.cjs +26 -0
- package/dist/ws/llm.test.cjs.map +1 -0
- package/dist/ws/llm.test.d.cts +2 -0
- package/dist/ws/llm.test.d.ts +2 -0
- package/dist/ws/llm.test.d.ts.map +1 -0
- package/dist/ws/llm.test.js +25 -0
- package/dist/ws/llm.test.js.map +1 -0
- package/dist/ws/types.cjs +128 -0
- package/dist/ws/types.cjs.map +1 -0
- package/dist/ws/types.d.cts +167 -0
- package/dist/ws/types.d.ts +167 -0
- package/dist/ws/types.d.ts.map +1 -0
- package/dist/ws/types.js +95 -0
- package/dist/ws/types.js.map +1 -0
- package/package.json +6 -5
- package/src/index.ts +1 -0
- package/src/llm.test.ts +31 -17
- package/src/llm.ts +9 -0
- package/src/realtime/api_proto.ts +8 -2
- package/src/realtime/realtime_model.test.ts +129 -14
- package/src/realtime/realtime_model.ts +51 -26
- package/src/realtime/realtime_model_beta.ts +42 -25
- package/src/responses/llm.test.ts +32 -18
- package/src/responses/llm.ts +105 -19
- package/src/stt.test.ts +12 -4
- package/src/stt.ts +21 -4
- package/src/tts.test.ts +12 -4
- package/src/tts.ts +13 -0
- package/src/ws/index.ts +17 -0
- package/src/ws/llm.test.ts +30 -0
- package/src/ws/llm.ts +665 -0
- package/src/ws/types.ts +131 -0
package/src/ws/types.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 LiveKit, Inc.
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Client → Server events
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export const wsResponseCreateEventSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
type: z.literal('response.create'),
|
|
13
|
+
model: z.string(),
|
|
14
|
+
input: z.array(z.unknown()),
|
|
15
|
+
tools: z.array(z.unknown()).optional(),
|
|
16
|
+
previous_response_id: z.string().nullable().optional(),
|
|
17
|
+
store: z.boolean().optional(),
|
|
18
|
+
temperature: z.number().optional(),
|
|
19
|
+
metadata: z.record(z.string(), z.string()).optional(),
|
|
20
|
+
})
|
|
21
|
+
.passthrough();
|
|
22
|
+
|
|
23
|
+
export type WsResponseCreateEvent = z.infer<typeof wsResponseCreateEventSchema>;
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Server → Client events
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
export const wsResponseCreatedEventSchema = z.object({
|
|
30
|
+
type: z.literal('response.created'),
|
|
31
|
+
response: z
|
|
32
|
+
.object({
|
|
33
|
+
id: z.string(),
|
|
34
|
+
})
|
|
35
|
+
.passthrough(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const wsFunctionCallItemSchema = z.object({
|
|
39
|
+
type: z.literal('function_call'),
|
|
40
|
+
call_id: z.string(),
|
|
41
|
+
name: z.string(),
|
|
42
|
+
arguments: z.string(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const wsOutputItemSchema = z.discriminatedUnion('type', [
|
|
46
|
+
wsFunctionCallItemSchema,
|
|
47
|
+
z.object({ type: z.literal('message') }).passthrough(),
|
|
48
|
+
z.object({ type: z.literal('reasoning') }).passthrough(),
|
|
49
|
+
z.object({ type: z.literal('file') }).passthrough(),
|
|
50
|
+
z.object({ type: z.literal('computer_call') }).passthrough(),
|
|
51
|
+
z.object({ type: z.literal('web_search_call') }).passthrough(),
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
export const wsOutputItemDoneEventSchema = z.object({
|
|
55
|
+
type: z.literal('response.output_item.done'),
|
|
56
|
+
item: wsOutputItemSchema,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const wsOutputTextDeltaEventSchema = z.object({
|
|
60
|
+
type: z.literal('response.output_text.delta'),
|
|
61
|
+
delta: z.string(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const wsResponseCompletedEventSchema = z.object({
|
|
65
|
+
type: z.literal('response.completed'),
|
|
66
|
+
response: z
|
|
67
|
+
.object({
|
|
68
|
+
id: z.string(),
|
|
69
|
+
usage: z
|
|
70
|
+
.object({
|
|
71
|
+
output_tokens: z.number(),
|
|
72
|
+
input_tokens: z.number(),
|
|
73
|
+
total_tokens: z.number(),
|
|
74
|
+
input_tokens_details: z
|
|
75
|
+
.object({
|
|
76
|
+
cached_tokens: z.number(),
|
|
77
|
+
})
|
|
78
|
+
.passthrough(),
|
|
79
|
+
})
|
|
80
|
+
.optional(),
|
|
81
|
+
})
|
|
82
|
+
.passthrough(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const wsResponseFailedEventSchema = z.object({
|
|
86
|
+
type: z.literal('response.failed'),
|
|
87
|
+
response: z
|
|
88
|
+
.object({
|
|
89
|
+
id: z.string().optional(),
|
|
90
|
+
error: z
|
|
91
|
+
.object({
|
|
92
|
+
code: z.string().optional(),
|
|
93
|
+
message: z.string().optional(),
|
|
94
|
+
})
|
|
95
|
+
.optional(),
|
|
96
|
+
})
|
|
97
|
+
.passthrough(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const wsErrorEventSchema = z.object({
|
|
101
|
+
type: z.literal('error'),
|
|
102
|
+
status: z.number().optional(),
|
|
103
|
+
error: z
|
|
104
|
+
.object({
|
|
105
|
+
type: z.string().optional(),
|
|
106
|
+
code: z.string().optional(),
|
|
107
|
+
message: z.string().optional(),
|
|
108
|
+
param: z.string().optional(),
|
|
109
|
+
})
|
|
110
|
+
.optional(),
|
|
111
|
+
message: z.string().optional(),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export const wsServerEventSchema = z.discriminatedUnion('type', [
|
|
115
|
+
wsResponseCreatedEventSchema,
|
|
116
|
+
wsOutputItemDoneEventSchema,
|
|
117
|
+
wsOutputTextDeltaEventSchema,
|
|
118
|
+
wsResponseCompletedEventSchema,
|
|
119
|
+
wsResponseFailedEventSchema,
|
|
120
|
+
wsErrorEventSchema,
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
export type WsResponseCreatedEvent = z.infer<typeof wsResponseCreatedEventSchema>;
|
|
124
|
+
export type WsFunctionCallItem = z.infer<typeof wsFunctionCallItemSchema>;
|
|
125
|
+
export type WsOutputItem = z.infer<typeof wsOutputItemSchema>;
|
|
126
|
+
export type WsOutputItemDoneEvent = z.infer<typeof wsOutputItemDoneEventSchema>;
|
|
127
|
+
export type WsOutputTextDeltaEvent = z.infer<typeof wsOutputTextDeltaEventSchema>;
|
|
128
|
+
export type WsResponseCompletedEvent = z.infer<typeof wsResponseCompletedEventSchema>;
|
|
129
|
+
export type WsResponseFailedEvent = z.infer<typeof wsResponseFailedEventSchema>;
|
|
130
|
+
export type WsErrorEvent = z.infer<typeof wsErrorEventSchema>;
|
|
131
|
+
export type WsServerEvent = z.infer<typeof wsServerEventSchema>;
|