@livekit/agents-plugin-openai 1.9.2 → 1.9.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/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/models.cjs.map +1 -1
- package/dist/models.d.cts +1 -0
- package/dist/models.d.ts +1 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/realtime/api_proto.cjs +3 -21
- package/dist/realtime/api_proto.cjs.map +1 -1
- package/dist/realtime/api_proto.d.cts +1 -504
- package/dist/realtime/api_proto.d.ts +1 -504
- package/dist/realtime/api_proto.d.ts.map +1 -1
- package/dist/realtime/api_proto.js +1 -12
- package/dist/realtime/api_proto.js.map +1 -1
- package/dist/realtime/gpt_live_model.cjs +7 -851
- package/dist/realtime/gpt_live_model.cjs.map +1 -1
- package/dist/realtime/gpt_live_model.d.cts +6 -178
- package/dist/realtime/gpt_live_model.d.ts +6 -178
- package/dist/realtime/gpt_live_model.d.ts.map +1 -1
- package/dist/realtime/gpt_live_model.js +7 -850
- package/dist/realtime/gpt_live_model.js.map +1 -1
- package/dist/realtime/gpt_live_model.test.cjs +32 -1
- package/dist/realtime/gpt_live_model.test.cjs.map +1 -1
- package/dist/realtime/gpt_live_model.test.js +32 -1
- package/dist/realtime/gpt_live_model.test.js.map +1 -1
- package/dist/realtime/gpt_live_types.cjs +6 -0
- package/dist/realtime/gpt_live_types.cjs.map +1 -1
- package/dist/realtime/gpt_live_types.d.cts +1 -169
- package/dist/realtime/gpt_live_types.d.ts +1 -169
- package/dist/realtime/gpt_live_types.d.ts.map +1 -1
- package/dist/realtime/gpt_live_types.js +1 -0
- package/dist/realtime/gpt_live_types.js.map +1 -1
- package/dist/realtime/index.cjs +8 -1
- package/dist/realtime/index.cjs.map +1 -1
- package/dist/realtime/index.d.cts +5 -0
- package/dist/realtime/index.d.ts +5 -0
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/index.js +6 -1
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime/realtime_model.cjs +3 -1890
- package/dist/realtime/realtime_model.cjs.map +1 -1
- package/dist/realtime/realtime_model.d.cts +1 -236
- package/dist/realtime/realtime_model.d.ts +1 -236
- package/dist/realtime/realtime_model.d.ts.map +1 -1
- package/dist/realtime/realtime_model.js +1 -1886
- package/dist/realtime/realtime_model.js.map +1 -1
- package/dist/realtime/realtime_model.test.cjs +11 -1141
- package/dist/realtime/realtime_model.test.cjs.map +1 -1
- package/dist/realtime/realtime_model.test.js +16 -1147
- package/dist/realtime/realtime_model.test.js.map +1 -1
- package/dist/tool_utils.test.cjs +3 -1
- package/dist/tool_utils.test.cjs.map +1 -1
- package/dist/tool_utils.test.js +3 -1
- package/dist/tool_utils.test.js.map +1 -1
- package/package.json +5 -6
- package/src/models.ts +2 -0
- package/src/realtime/api_proto.ts +2 -715
- package/src/realtime/gpt_live_model.test.ts +42 -1
- package/src/realtime/gpt_live_model.ts +17 -1030
- package/src/realtime/gpt_live_types.ts +1 -136
- package/src/realtime/index.ts +7 -0
- package/src/realtime/realtime_model.test.ts +17 -1454
- package/src/realtime/realtime_model.ts +2 -2408
- package/src/tool_utils.test.ts +3 -1
|
@@ -1,140 +1,5 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import type OpenAI from 'openai';
|
|
5
|
-
import type { Reasoning } from 'openai/resources/shared.js';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
export type DelegationTarget = 'responses' | 'client';
|
|
9
|
-
/** Roles accepted in initial session history. @public */
|
|
10
|
-
export type InputRole = 'developer' | 'user' | 'assistant';
|
|
11
|
-
/** A text message used to seed session history. @public */
|
|
12
|
-
export interface InputItem {
|
|
13
|
-
type: 'message';
|
|
14
|
-
role: InputRole;
|
|
15
|
-
content: { type: 'input_text' | 'output_text'; text: string }[];
|
|
16
|
-
}
|
|
17
|
-
/** Backend Responses API options, using wire field names. @public */
|
|
18
|
-
export interface ResponsesConfig {
|
|
19
|
-
model?: string;
|
|
20
|
-
instructions?: string;
|
|
21
|
-
tools?: OpenAI.Responses.Tool[];
|
|
22
|
-
tool_choice?: string | { type: 'function'; name: string };
|
|
23
|
-
parallel_tool_calls?: boolean;
|
|
24
|
-
reasoning?: Reasoning;
|
|
25
|
-
text?: OpenAI.Responses.ResponseTextConfig;
|
|
26
|
-
service_tier?: 'auto' | 'default' | 'flex' | 'priority';
|
|
27
|
-
max_output_tokens?: number;
|
|
28
|
-
}
|
|
29
|
-
/** Choose the backend Responses model or application callbacks. @public */
|
|
30
|
-
export type Delegation = { type: 'client' } | { type: 'responses'; responses: ResponsesConfig };
|
|
31
|
-
/** Initial voice, audio, context, and delegation configuration. @public */
|
|
32
|
-
export interface SessionConfig {
|
|
33
|
-
model: string;
|
|
34
|
-
instructions?: string;
|
|
35
|
-
input?: InputItem[];
|
|
36
|
-
audio?: {
|
|
37
|
-
format?: { type: 'audio/pcm' | 'audio/pcmu' | 'audio/pcma'; rate: number };
|
|
38
|
-
output?: { voice?: string | Record<string, unknown> };
|
|
39
|
-
};
|
|
40
|
-
delegation?: Delegation;
|
|
41
|
-
}
|
|
42
|
-
/** Commands sent to the GPT-Live WebSocket. @public */
|
|
43
|
-
export type ClientEvent = { event_id?: string } & (
|
|
44
|
-
| { type: 'session.start'; session: SessionConfig }
|
|
45
|
-
| { type: 'session.update'; session: { delegation: Delegation } }
|
|
46
|
-
| { type: 'session.input_audio.append'; audio: string }
|
|
47
|
-
| {
|
|
48
|
-
type:
|
|
49
|
-
| 'session.input_audio.mute'
|
|
50
|
-
| 'session.input_audio.unmute'
|
|
51
|
-
| 'session.close'
|
|
52
|
-
| 'response.create';
|
|
53
|
-
}
|
|
54
|
-
| {
|
|
55
|
-
type: 'session.instructions.append' | 'session.thinking.append' | 'session.commentary.append';
|
|
56
|
-
/** Required on every append, including when no delegation is being answered. */
|
|
57
|
-
delegation_id: string | null;
|
|
58
|
-
content: string;
|
|
59
|
-
}
|
|
60
|
-
| { type: 'response.item.create'; item: OpenAI.Responses.ResponseInputItem }
|
|
61
|
-
);
|
|
62
|
-
/** Backend response token usage, separate from voice session duration. @public */
|
|
63
|
-
export interface ResponseUsage {
|
|
64
|
-
input_tokens?: number;
|
|
65
|
-
input_tokens_details?: { cached_tokens?: number; cache_write_tokens?: number };
|
|
66
|
-
output_tokens?: number;
|
|
67
|
-
output_tokens_details?: { reasoning_tokens?: number };
|
|
68
|
-
total_tokens?: number;
|
|
69
|
-
}
|
|
70
|
-
/** Responses API events nested inside a GPT-Live response.event. @public */
|
|
71
|
-
export interface ResponsesEvent {
|
|
72
|
-
type: string;
|
|
73
|
-
response?: {
|
|
74
|
-
id?: string | null;
|
|
75
|
-
model?: string | null;
|
|
76
|
-
usage?: ResponseUsage | null;
|
|
77
|
-
error?: Record<string, unknown> | null;
|
|
78
|
-
incomplete_details?: Record<string, unknown> | null;
|
|
79
|
-
} | null;
|
|
80
|
-
item?: {
|
|
81
|
-
id?: string | null;
|
|
82
|
-
type?: string | null;
|
|
83
|
-
call_id?: string | null;
|
|
84
|
-
name?: string | null;
|
|
85
|
-
arguments?: string | null;
|
|
86
|
-
} | null;
|
|
87
|
-
}
|
|
88
|
-
/** Provider error details. Messages can contain customer content. @public */
|
|
89
|
-
export interface ErrorBody {
|
|
90
|
-
type?: string | null;
|
|
91
|
-
code?: string | null;
|
|
92
|
-
message?: string;
|
|
93
|
-
param?: string | null;
|
|
94
|
-
client_event_id?: string | null;
|
|
95
|
-
}
|
|
96
|
-
/** Server fields are optional so missing fields do not end a session. @public */
|
|
97
|
-
export type ServerEvent =
|
|
98
|
-
| { type: 'session.started'; session?: { id?: string | null } }
|
|
99
|
-
| { type: 'session.output_audio.delta'; delta?: string }
|
|
100
|
-
| {
|
|
101
|
-
type: 'session.output_transcript.delta' | 'session.input_transcript.delta';
|
|
102
|
-
delta?: string;
|
|
103
|
-
start_ms?: number | null;
|
|
104
|
-
end_ms?: number | null;
|
|
105
|
-
}
|
|
106
|
-
| {
|
|
107
|
-
type: 'session.delegation.created';
|
|
108
|
-
delegation?: { id?: string | null; target?: DelegationTarget | null };
|
|
109
|
-
}
|
|
110
|
-
| { type: 'response.event'; delegation_id?: string | null; event?: ResponsesEvent }
|
|
111
|
-
| {
|
|
112
|
-
type: 'session.usage.updated';
|
|
113
|
-
usage?: { seconds?: number };
|
|
114
|
-
context_window?: { usage_ratio?: number | null } | null;
|
|
115
|
-
}
|
|
116
|
-
| {
|
|
117
|
-
type: 'session.closed';
|
|
118
|
-
reason?:
|
|
119
|
-
| 'close_requested'
|
|
120
|
-
| 'expired'
|
|
121
|
-
| 'content'
|
|
122
|
-
| 'remote_hangup'
|
|
123
|
-
| 'connection_lost'
|
|
124
|
-
| null;
|
|
125
|
-
usage?: { seconds?: number };
|
|
126
|
-
context_window?: { usage_ratio?: number | null } | null;
|
|
127
|
-
}
|
|
128
|
-
| { type: 'error'; error?: ErrorBody }
|
|
129
|
-
| {
|
|
130
|
-
type: 'session.updated' | 'session.input_audio.muted' | 'session.input_audio.unmuted';
|
|
131
|
-
client_event_id?: string;
|
|
132
|
-
}
|
|
133
|
-
| {
|
|
134
|
-
/** Sent at the estimated context-injection end; does not indicate speech completion. */
|
|
135
|
-
type:
|
|
136
|
-
| 'session.instructions.appended'
|
|
137
|
-
| 'session.thinking.appended'
|
|
138
|
-
| 'session.commentary.appended';
|
|
139
|
-
client_event_id?: string;
|
|
140
|
-
};
|
|
5
|
+
export * from '@livekit/agents/llm/openai_realtime/gpt_live_types';
|
package/src/realtime/index.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { inference } from '@livekit/agents';
|
|
5
|
+
|
|
4
6
|
export * from './api_proto.js';
|
|
5
7
|
export * from './realtime_model.js';
|
|
6
8
|
export * from './gpt_live_model.js';
|
|
7
9
|
export * as GPTLive from './gpt_live_types.js';
|
|
10
|
+
|
|
11
|
+
/** @deprecated Use `inference.RealtimeModel` from `@livekit/agents`. */
|
|
12
|
+
export const InferenceRealtimeModel = inference.RealtimeModel;
|
|
13
|
+
/** @deprecated Use `inference.RealtimeSession` from `@livekit/agents`. */
|
|
14
|
+
export const InferenceRealtimeSession = inference.RealtimeSession;
|