@openai/agents-realtime 0.0.1

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.
Files changed (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/bundle/openai-realtime-agents.mjs +8777 -0
  4. package/dist/bundle/openai-realtime-agents.umd.js +11 -0
  5. package/dist/clientMessages.d.ts +40 -0
  6. package/dist/clientMessages.js +2 -0
  7. package/dist/clientMessages.js.map +1 -0
  8. package/dist/clientMessages.mjs +2 -0
  9. package/dist/clientMessages.mjs.map +1 -0
  10. package/dist/guardrail.d.ts +32 -0
  11. package/dist/guardrail.js +34 -0
  12. package/dist/guardrail.js.map +1 -0
  13. package/dist/guardrail.mjs +34 -0
  14. package/dist/guardrail.mjs.map +1 -0
  15. package/dist/index.d.ts +18 -0
  16. package/dist/index.js +13 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.mjs +13 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/dist/items.d.ts +183 -0
  21. package/dist/items.js +47 -0
  22. package/dist/items.js.map +1 -0
  23. package/dist/items.mjs +47 -0
  24. package/dist/items.mjs.map +1 -0
  25. package/dist/logger.d.ts +2 -0
  26. package/dist/logger.js +4 -0
  27. package/dist/logger.js.map +1 -0
  28. package/dist/logger.mjs +4 -0
  29. package/dist/logger.mjs.map +1 -0
  30. package/dist/metadata.d.ts +9 -0
  31. package/dist/metadata.js +11 -0
  32. package/dist/metadata.js.map +1 -0
  33. package/dist/metadata.mjs +11 -0
  34. package/dist/metadata.mjs.map +1 -0
  35. package/dist/openaiRealtimeBase.d.ts +143 -0
  36. package/dist/openaiRealtimeBase.js +449 -0
  37. package/dist/openaiRealtimeBase.js.map +1 -0
  38. package/dist/openaiRealtimeBase.mjs +449 -0
  39. package/dist/openaiRealtimeBase.mjs.map +1 -0
  40. package/dist/openaiRealtimeEvents.d.ts +3242 -0
  41. package/dist/openaiRealtimeEvents.js +439 -0
  42. package/dist/openaiRealtimeEvents.js.map +1 -0
  43. package/dist/openaiRealtimeEvents.mjs +439 -0
  44. package/dist/openaiRealtimeEvents.mjs.map +1 -0
  45. package/dist/openaiRealtimeWebRtc.d.ts +102 -0
  46. package/dist/openaiRealtimeWebRtc.js +245 -0
  47. package/dist/openaiRealtimeWebRtc.js.map +1 -0
  48. package/dist/openaiRealtimeWebRtc.mjs +245 -0
  49. package/dist/openaiRealtimeWebRtc.mjs.map +1 -0
  50. package/dist/openaiRealtimeWebsocket.d.ts +126 -0
  51. package/dist/openaiRealtimeWebsocket.js +293 -0
  52. package/dist/openaiRealtimeWebsocket.js.map +1 -0
  53. package/dist/openaiRealtimeWebsocket.mjs +293 -0
  54. package/dist/openaiRealtimeWebsocket.mjs.map +1 -0
  55. package/dist/realtimeAgent.d.ts +49 -0
  56. package/dist/realtimeAgent.js +37 -0
  57. package/dist/realtimeAgent.js.map +1 -0
  58. package/dist/realtimeAgent.mjs +37 -0
  59. package/dist/realtimeAgent.mjs.map +1 -0
  60. package/dist/realtimeSession.d.ts +210 -0
  61. package/dist/realtimeSession.js +469 -0
  62. package/dist/realtimeSession.js.map +1 -0
  63. package/dist/realtimeSession.mjs +469 -0
  64. package/dist/realtimeSession.mjs.map +1 -0
  65. package/dist/realtimeSessionEvents.d.ts +118 -0
  66. package/dist/realtimeSessionEvents.js +2 -0
  67. package/dist/realtimeSessionEvents.js.map +1 -0
  68. package/dist/realtimeSessionEvents.mjs +2 -0
  69. package/dist/realtimeSessionEvents.mjs.map +1 -0
  70. package/dist/shims/shims-browser.d.ts +9 -0
  71. package/dist/shims/shims-browser.js +6 -0
  72. package/dist/shims/shims-browser.js.map +1 -0
  73. package/dist/shims/shims-browser.mjs +6 -0
  74. package/dist/shims/shims-browser.mjs.map +1 -0
  75. package/dist/shims/shims-node.d.ts +2 -0
  76. package/dist/shims/shims-node.js +5 -0
  77. package/dist/shims/shims-node.js.map +1 -0
  78. package/dist/shims/shims-node.mjs +5 -0
  79. package/dist/shims/shims-node.mjs.map +1 -0
  80. package/dist/shims/shims.d.ts +1 -0
  81. package/dist/shims/shims.js +2 -0
  82. package/dist/shims/shims.js.map +1 -0
  83. package/dist/shims/shims.mjs +2 -0
  84. package/dist/shims/shims.mjs.map +1 -0
  85. package/dist/transportLayer.d.ts +96 -0
  86. package/dist/transportLayer.js +2 -0
  87. package/dist/transportLayer.js.map +1 -0
  88. package/dist/transportLayer.mjs +2 -0
  89. package/dist/transportLayer.mjs.map +1 -0
  90. package/dist/transportLayerEvents.d.ts +99 -0
  91. package/dist/transportLayerEvents.js +2 -0
  92. package/dist/transportLayerEvents.js.map +1 -0
  93. package/dist/transportLayerEvents.mjs +2 -0
  94. package/dist/transportLayerEvents.mjs.map +1 -0
  95. package/dist/utils.d.ts +61 -0
  96. package/dist/utils.js +183 -0
  97. package/dist/utils.js.map +1 -0
  98. package/dist/utils.mjs +183 -0
  99. package/dist/utils.mjs.map +1 -0
  100. package/package.json +77 -0
@@ -0,0 +1,439 @@
1
+ import { z } from '@openai/zod/v3';
2
+ // Event schemas mirroring the structures defined in the OpenAI SDK typings.
3
+ // Most fields from the interfaces in `realtime.d.ts` are captured here to
4
+ // provide better runtime validation when parsing events from the server.
5
+ export const realtimeResponse = z.object({
6
+ id: z.string().optional(),
7
+ conversation_id: z.string().optional(),
8
+ max_output_tokens: z.number().or(z.literal('inf')).optional(),
9
+ metadata: z.record(z.string(), z.any()).optional().nullable(),
10
+ modalities: z.array(z.string()).optional(),
11
+ object: z.literal('realtime.response').optional(),
12
+ output: z.array(z.any()).optional(),
13
+ output_audio_format: z.string().optional(),
14
+ status: z.enum(['completed', 'incomplete', 'failed', 'cancelled']).optional(),
15
+ status_details: z.record(z.string(), z.any()).optional().nullable(),
16
+ usage: z
17
+ .object({
18
+ input_tokens: z.number().optional(),
19
+ input_tokens_details: z.record(z.string(), z.any()).optional().nullable(),
20
+ output_tokens: z.number().optional(),
21
+ output_tokens_details: z
22
+ .record(z.string(), z.any())
23
+ .optional()
24
+ .nullable(),
25
+ })
26
+ .optional(),
27
+ voice: z.string().optional(),
28
+ });
29
+ // Basic content schema used by ConversationItem.
30
+ export const conversationItemContentSchema = z.object({
31
+ id: z.string().optional(),
32
+ audio: z.string().nullable().optional(),
33
+ text: z.string().nullable().optional(),
34
+ transcript: z.string().nullable().optional(),
35
+ type: z.union([
36
+ z.literal('input_text'),
37
+ z.literal('input_audio'),
38
+ z.literal('item_reference'),
39
+ z.literal('text'),
40
+ z.literal('audio'),
41
+ ]),
42
+ });
43
+ export const conversationItemSchema = z.object({
44
+ id: z.string().optional(),
45
+ arguments: z.string().optional(),
46
+ call_id: z.string().optional(),
47
+ content: z.array(conversationItemContentSchema).optional(),
48
+ name: z.string().optional(),
49
+ object: z.literal('realtime.item').optional(),
50
+ output: z.string().optional(),
51
+ role: z.enum(['user', 'assistant', 'system']).optional(),
52
+ status: z.enum(['completed', 'incomplete', 'in_progress']).optional(),
53
+ type: z.enum(['message', 'function_call', 'function_call_output']).optional(),
54
+ });
55
+ export const conversationCreatedEventSchema = z.object({
56
+ type: z.literal('conversation.created'),
57
+ event_id: z.string(),
58
+ conversation: z.object({
59
+ id: z.string().optional(),
60
+ object: z.literal('realtime.conversation').optional(),
61
+ }),
62
+ });
63
+ export const conversationItemCreatedEventSchema = z.object({
64
+ type: z.literal('conversation.item.created'),
65
+ event_id: z.string(),
66
+ item: conversationItemSchema,
67
+ previous_item_id: z.string().nullable().optional(),
68
+ });
69
+ export const conversationItemDeletedEventSchema = z.object({
70
+ type: z.literal('conversation.item.deleted'),
71
+ event_id: z.string(),
72
+ item_id: z.string(),
73
+ });
74
+ export const conversationItemInputAudioTranscriptionCompletedEventSchema = z.object({
75
+ type: z.literal('conversation.item.input_audio_transcription.completed'),
76
+ event_id: z.string(),
77
+ item_id: z.string(),
78
+ content_index: z.number(),
79
+ transcript: z.string(),
80
+ logprobs: z.array(z.any()).nullable().optional(),
81
+ });
82
+ export const conversationItemInputAudioTranscriptionDeltaEventSchema = z.object({
83
+ type: z.literal('conversation.item.input_audio_transcription.delta'),
84
+ event_id: z.string(),
85
+ item_id: z.string(),
86
+ content_index: z.number().optional(),
87
+ delta: z.string().optional(),
88
+ logprobs: z.array(z.any()).nullable().optional(),
89
+ });
90
+ export const conversationItemInputAudioTranscriptionFailedEventSchema = z.object({
91
+ type: z.literal('conversation.item.input_audio_transcription.failed'),
92
+ event_id: z.string(),
93
+ item_id: z.string(),
94
+ content_index: z.number(),
95
+ error: z.object({
96
+ code: z.string().optional(),
97
+ message: z.string().optional(),
98
+ param: z.string().optional(),
99
+ type: z.string().optional(),
100
+ }),
101
+ });
102
+ export const conversationItemRetrievedEventSchema = z.object({
103
+ type: z.literal('conversation.item.retrieved'),
104
+ event_id: z.string(),
105
+ item: conversationItemSchema,
106
+ });
107
+ export const conversationItemTruncatedEventSchema = z.object({
108
+ type: z.literal('conversation.item.truncated'),
109
+ event_id: z.string(),
110
+ item_id: z.string(),
111
+ audio_end_ms: z.number(),
112
+ content_index: z.number(),
113
+ });
114
+ export const conversationItemCreateEventSchema = z.object({
115
+ type: z.literal('conversation.item.create'),
116
+ item: conversationItemSchema,
117
+ event_id: z.string().optional(),
118
+ previous_item_id: z.string().nullable().optional(),
119
+ });
120
+ export const conversationItemDeleteEventSchema = z.object({
121
+ type: z.literal('conversation.item.delete'),
122
+ item_id: z.string(),
123
+ event_id: z.string().optional(),
124
+ });
125
+ export const conversationItemRetrieveEventSchema = z.object({
126
+ type: z.literal('conversation.item.retrieve'),
127
+ item_id: z.string(),
128
+ event_id: z.string().optional(),
129
+ });
130
+ export const conversationItemTruncateEventSchema = z.object({
131
+ type: z.literal('conversation.item.truncate'),
132
+ item_id: z.string(),
133
+ audio_end_ms: z.number(),
134
+ content_index: z.number(),
135
+ event_id: z.string().optional(),
136
+ });
137
+ export const errorEventSchema = z.object({
138
+ type: z.literal('error'),
139
+ event_id: z.string().optional(),
140
+ error: z.any().optional(),
141
+ });
142
+ export const inputAudioBufferClearedEventSchema = z.object({
143
+ type: z.literal('input_audio_buffer.cleared'),
144
+ event_id: z.string(),
145
+ });
146
+ export const inputAudioBufferAppendEventSchema = z.object({
147
+ type: z.literal('input_audio_buffer.append'),
148
+ audio: z.string(),
149
+ event_id: z.string().optional(),
150
+ });
151
+ export const inputAudioBufferClearEventSchema = z.object({
152
+ type: z.literal('input_audio_buffer.clear'),
153
+ event_id: z.string().optional(),
154
+ });
155
+ export const inputAudioBufferCommitEventSchema = z.object({
156
+ type: z.literal('input_audio_buffer.commit'),
157
+ event_id: z.string().optional(),
158
+ });
159
+ export const inputAudioBufferCommittedEventSchema = z.object({
160
+ type: z.literal('input_audio_buffer.committed'),
161
+ event_id: z.string(),
162
+ item_id: z.string(),
163
+ previous_item_id: z.string().nullable().optional(),
164
+ });
165
+ export const inputAudioBufferSpeechStartedEventSchema = z.object({
166
+ type: z.literal('input_audio_buffer.speech_started'),
167
+ event_id: z.string(),
168
+ item_id: z.string(),
169
+ audio_start_ms: z.number(),
170
+ });
171
+ export const inputAudioBufferSpeechStoppedEventSchema = z.object({
172
+ type: z.literal('input_audio_buffer.speech_stopped'),
173
+ event_id: z.string(),
174
+ item_id: z.string(),
175
+ audio_end_ms: z.number(),
176
+ });
177
+ export const outputAudioBufferStartedEventSchema = z
178
+ .object({
179
+ type: z.literal('output_audio_buffer.started'),
180
+ event_id: z.string(),
181
+ })
182
+ .passthrough();
183
+ export const outputAudioBufferStoppedEventSchema = z
184
+ .object({
185
+ type: z.literal('output_audio_buffer.stopped'),
186
+ event_id: z.string(),
187
+ })
188
+ .passthrough();
189
+ export const outputAudioBufferClearedEventSchema = z.object({
190
+ type: z.literal('output_audio_buffer.cleared'),
191
+ event_id: z.string(),
192
+ });
193
+ export const rateLimitsUpdatedEventSchema = z.object({
194
+ type: z.literal('rate_limits.updated'),
195
+ event_id: z.string(),
196
+ rate_limits: z.array(z.object({
197
+ limit: z.number().optional(),
198
+ name: z.enum(['requests', 'tokens']).optional(),
199
+ remaining: z.number().optional(),
200
+ reset_seconds: z.number().optional(),
201
+ })),
202
+ });
203
+ export const responseAudioDeltaEventSchema = z.object({
204
+ type: z.literal('response.audio.delta'),
205
+ event_id: z.string(),
206
+ item_id: z.string(),
207
+ content_index: z.number(),
208
+ delta: z.string(),
209
+ output_index: z.number(),
210
+ response_id: z.string(),
211
+ });
212
+ export const responseAudioDoneEventSchema = z.object({
213
+ type: z.literal('response.audio.done'),
214
+ event_id: z.string(),
215
+ item_id: z.string(),
216
+ content_index: z.number(),
217
+ output_index: z.number(),
218
+ response_id: z.string(),
219
+ });
220
+ export const responseAudioTranscriptDeltaEventSchema = z.object({
221
+ type: z.literal('response.audio_transcript.delta'),
222
+ event_id: z.string(),
223
+ item_id: z.string(),
224
+ content_index: z.number(),
225
+ delta: z.string(),
226
+ output_index: z.number(),
227
+ response_id: z.string(),
228
+ });
229
+ export const responseAudioTranscriptDoneEventSchema = z.object({
230
+ type: z.literal('response.audio_transcript.done'),
231
+ event_id: z.string(),
232
+ item_id: z.string(),
233
+ content_index: z.number(),
234
+ transcript: z.string(),
235
+ output_index: z.number(),
236
+ response_id: z.string(),
237
+ });
238
+ export const responseContentPartAddedEventSchema = z.object({
239
+ type: z.literal('response.content_part.added'),
240
+ event_id: z.string(),
241
+ item_id: z.string(),
242
+ content_index: z.number(),
243
+ output_index: z.number(),
244
+ response_id: z.string(),
245
+ part: z.object({
246
+ audio: z.string().optional(),
247
+ text: z.string().optional(),
248
+ transcript: z.string().optional(),
249
+ type: z.enum(['text', 'audio']).optional(),
250
+ }),
251
+ });
252
+ export const responseContentPartDoneEventSchema = z.object({
253
+ type: z.literal('response.content_part.done'),
254
+ event_id: z.string(),
255
+ item_id: z.string(),
256
+ content_index: z.number(),
257
+ output_index: z.number(),
258
+ response_id: z.string(),
259
+ part: z.object({
260
+ audio: z.string().optional(),
261
+ text: z.string().optional(),
262
+ transcript: z.string().optional(),
263
+ type: z.enum(['text', 'audio']).optional(),
264
+ }),
265
+ });
266
+ export const responseCreatedEventSchema = z.object({
267
+ type: z.literal('response.created'),
268
+ event_id: z.string(),
269
+ response: realtimeResponse,
270
+ });
271
+ export const responseDoneEventSchema = z.object({
272
+ type: z.literal('response.done'),
273
+ event_id: z.string(),
274
+ response: realtimeResponse,
275
+ test: z.boolean(),
276
+ });
277
+ export const responseFunctionCallArgumentsDeltaEventSchema = z.object({
278
+ type: z.literal('response.function_call_arguments.delta'),
279
+ event_id: z.string(),
280
+ item_id: z.string(),
281
+ call_id: z.string(),
282
+ delta: z.string(),
283
+ output_index: z.number(),
284
+ response_id: z.string(),
285
+ });
286
+ export const responseFunctionCallArgumentsDoneEventSchema = z.object({
287
+ type: z.literal('response.function_call_arguments.done'),
288
+ event_id: z.string(),
289
+ item_id: z.string(),
290
+ call_id: z.string(),
291
+ arguments: z.string(),
292
+ output_index: z.number(),
293
+ response_id: z.string(),
294
+ });
295
+ export const responseOutputItemAddedEventSchema = z.object({
296
+ type: z.literal('response.output_item.added'),
297
+ event_id: z.string(),
298
+ item: conversationItemSchema,
299
+ output_index: z.number(),
300
+ response_id: z.string(),
301
+ });
302
+ export const responseOutputItemDoneEventSchema = z.object({
303
+ type: z.literal('response.output_item.done'),
304
+ event_id: z.string(),
305
+ item: conversationItemSchema,
306
+ output_index: z.number(),
307
+ response_id: z.string(),
308
+ });
309
+ export const responseTextDeltaEventSchema = z.object({
310
+ type: z.literal('response.text.delta'),
311
+ event_id: z.string(),
312
+ item_id: z.string(),
313
+ content_index: z.number(),
314
+ delta: z.string(),
315
+ output_index: z.number(),
316
+ response_id: z.string(),
317
+ });
318
+ export const responseTextDoneEventSchema = z.object({
319
+ type: z.literal('response.text.done'),
320
+ event_id: z.string(),
321
+ item_id: z.string(),
322
+ content_index: z.number(),
323
+ text: z.string(),
324
+ output_index: z.number(),
325
+ response_id: z.string(),
326
+ });
327
+ export const sessionCreatedEventSchema = z.object({
328
+ type: z.literal('session.created'),
329
+ event_id: z.string(),
330
+ session: z.any(),
331
+ });
332
+ export const sessionUpdatedEventSchema = z.object({
333
+ type: z.literal('session.updated'),
334
+ event_id: z.string(),
335
+ session: z.any(),
336
+ });
337
+ export const responseCancelEventSchema = z.object({
338
+ type: z.literal('response.cancel'),
339
+ event_id: z.string().optional(),
340
+ response_id: z.string().optional(),
341
+ });
342
+ export const responseCreateEventSchema = z.object({
343
+ type: z.literal('response.create'),
344
+ event_id: z.string().optional(),
345
+ response: z.any().optional(),
346
+ });
347
+ export const sessionUpdateEventSchema = z.object({
348
+ type: z.literal('session.update'),
349
+ event_id: z.string().optional(),
350
+ session: z.any(),
351
+ });
352
+ export const transcriptionSessionUpdateEventSchema = z.object({
353
+ type: z.literal('transcription_session.update'),
354
+ event_id: z.string().optional(),
355
+ session: z.any(),
356
+ });
357
+ export const transcriptionSessionUpdatedEventSchema = z.object({
358
+ type: z.literal('transcription_session.updated'),
359
+ event_id: z.string(),
360
+ session: z.any(),
361
+ });
362
+ /**
363
+ * This schema is used if an event is unknown to the client. The Realtime API might introduce
364
+ * new events at some point and we should handle them gracefully by treating them as generic events
365
+ * only requiring a type and an optional event_id.
366
+ */
367
+ export const genericEventSchema = z
368
+ .object({
369
+ type: z.string(),
370
+ event_id: z.string().optional().nullable(),
371
+ })
372
+ .passthrough();
373
+ export const realtimeServerEventSchema = z.discriminatedUnion('type', [
374
+ conversationCreatedEventSchema,
375
+ conversationItemCreatedEventSchema,
376
+ conversationItemDeletedEventSchema,
377
+ conversationItemInputAudioTranscriptionCompletedEventSchema,
378
+ conversationItemInputAudioTranscriptionDeltaEventSchema,
379
+ conversationItemInputAudioTranscriptionFailedEventSchema,
380
+ conversationItemRetrievedEventSchema,
381
+ conversationItemTruncatedEventSchema,
382
+ errorEventSchema,
383
+ inputAudioBufferClearedEventSchema,
384
+ inputAudioBufferCommittedEventSchema,
385
+ inputAudioBufferSpeechStartedEventSchema,
386
+ inputAudioBufferSpeechStoppedEventSchema,
387
+ outputAudioBufferStartedEventSchema,
388
+ outputAudioBufferStoppedEventSchema,
389
+ outputAudioBufferClearedEventSchema,
390
+ rateLimitsUpdatedEventSchema,
391
+ responseAudioDeltaEventSchema,
392
+ responseAudioDoneEventSchema,
393
+ responseAudioTranscriptDeltaEventSchema,
394
+ responseAudioTranscriptDoneEventSchema,
395
+ responseContentPartAddedEventSchema,
396
+ responseContentPartDoneEventSchema,
397
+ responseCreatedEventSchema,
398
+ responseDoneEventSchema,
399
+ responseFunctionCallArgumentsDeltaEventSchema,
400
+ responseFunctionCallArgumentsDoneEventSchema,
401
+ responseOutputItemAddedEventSchema,
402
+ responseOutputItemDoneEventSchema,
403
+ responseTextDeltaEventSchema,
404
+ responseTextDoneEventSchema,
405
+ sessionCreatedEventSchema,
406
+ sessionUpdatedEventSchema,
407
+ transcriptionSessionUpdatedEventSchema,
408
+ ]);
409
+ export const realtimeClientEventSchema = z.discriminatedUnion('type', [
410
+ conversationItemCreateEventSchema,
411
+ conversationItemDeleteEventSchema,
412
+ conversationItemRetrieveEventSchema,
413
+ conversationItemTruncateEventSchema,
414
+ inputAudioBufferAppendEventSchema,
415
+ inputAudioBufferClearEventSchema,
416
+ inputAudioBufferCommitEventSchema,
417
+ responseCancelEventSchema,
418
+ responseCreateEventSchema,
419
+ sessionUpdateEventSchema,
420
+ transcriptionSessionUpdateEventSchema,
421
+ ]);
422
+ /**
423
+ * Parses a realtime event from the server. If the event is unknown to the client, it will be treated as a generic event.
424
+ * @param event - The event to parse.
425
+ * @returns The parsed event or null if the event is unknown to the client.
426
+ */
427
+ export function parseRealtimeEvent(event) {
428
+ const raw = JSON.parse(event.data.toString());
429
+ const parsed = realtimeServerEventSchema.safeParse(raw);
430
+ if (!parsed.success) {
431
+ const genericParsed = genericEventSchema.safeParse(raw);
432
+ if (genericParsed.success) {
433
+ return { data: genericParsed.data, isGeneric: true };
434
+ }
435
+ return { data: null, isGeneric: true };
436
+ }
437
+ return { data: parsed.data, isGeneric: false };
438
+ }
439
+ //# sourceMappingURL=openaiRealtimeEvents.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openaiRealtimeEvents.m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C;IACnC,iCAAiC;IACjC,gCAAgC;IAChC,iCAAiC;IACjC,yBAAyB;IACzB,yBAAyB;IACzB,wBAAwB;IACxB,qCAAqC;CACtC,CAAC,CAAC;AAyBH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAA2C;IAE3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,yBAAyB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,aAAa,GAAG,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACxD,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QACvD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { RealtimeTransportLayer, RealtimeTransportLayerConnectOptions } from './transportLayer';
2
+ import { RealtimeClientMessage } from './clientMessages';
3
+ import { OpenAIRealtimeBase, OpenAIRealtimeBaseOptions } from './openaiRealtimeBase';
4
+ /**
5
+ * The connection state of the WebRTC connection.
6
+ */
7
+ export type WebRTCState = {
8
+ status: 'disconnected';
9
+ peerConnection: undefined;
10
+ dataChannel: undefined;
11
+ } | {
12
+ status: 'connecting';
13
+ peerConnection: RTCPeerConnection;
14
+ dataChannel: RTCDataChannel;
15
+ } | {
16
+ status: 'connected';
17
+ peerConnection: RTCPeerConnection;
18
+ dataChannel: RTCDataChannel;
19
+ };
20
+ /**
21
+ * The options for the OpenAI Realtime WebRTC transport layer.
22
+ */
23
+ export type OpenAIRealtimeWebRTCOptions = {
24
+ /**
25
+ * Override of the base URL for the Realtime API
26
+ */
27
+ baseUrl?: string;
28
+ /**
29
+ * The audio element to use for audio playback. If not provided, a new audio element will be
30
+ * created.
31
+ */
32
+ audioElement?: HTMLAudioElement;
33
+ /**
34
+ * The media stream to use for audio input. If not provided, the default microphone will be used.
35
+ */
36
+ mediaStream?: MediaStream;
37
+ /**
38
+ * **Important**: Do not use this option unless you know what you are doing.
39
+ *
40
+ * Whether to use an insecure API key. This has to be set if you are trying to use a regular
41
+ * OpenAI API key instead of a client ephemeral key.
42
+ * @see https://platform.openai.com/docs/guides/realtime#creating-an-ephemeral-token
43
+ */
44
+ useInsecureApiKey?: boolean;
45
+ } & OpenAIRealtimeBaseOptions;
46
+ /**
47
+ * Transport layer that's handling the connection between the client and OpenAI's Realtime API
48
+ * via WebRTC. While this transport layer is designed to be used within a RealtimeSession, it can
49
+ * also be used standalone if you want to have a direct connection to the Realtime API.
50
+ *
51
+ * Unless you specify a `mediaStream` or `audioElement` option, the transport layer will
52
+ * automatically configure the microphone and audio output to be used by the session.
53
+ */
54
+ export declare class OpenAIRealtimeWebRTC extends OpenAIRealtimeBase implements RealtimeTransportLayer {
55
+ #private;
56
+ private readonly options;
57
+ constructor(options?: OpenAIRealtimeWebRTCOptions);
58
+ /**
59
+ * The current status of the WebRTC connection.
60
+ */
61
+ get status(): "connecting" | "connected" | "disconnected";
62
+ /**
63
+ * The current connection state of the WebRTC connection including the peer connection and data
64
+ * channel.
65
+ */
66
+ get connectionState(): WebRTCState;
67
+ /**
68
+ * Whether the session is muted.
69
+ */
70
+ get muted(): boolean;
71
+ /**
72
+ * Connect to the Realtime API. This will establish the connection to the OpenAI Realtime API
73
+ * via WebRTC.
74
+ *
75
+ * If you are using a browser, the transport layer will also automatically configure the
76
+ * microphone and audio output to be used by the session.
77
+ *
78
+ * @param options - The options for the connection.
79
+ */
80
+ connect(options: RealtimeTransportLayerConnectOptions): Promise<void>;
81
+ /**
82
+ * Send an event to the Realtime API. This will stringify the event and send it directly to the
83
+ * API. This can be used if you want to take control over the connection and send events manually.
84
+ *
85
+ * @param event - The event to send.
86
+ */
87
+ sendEvent(event: RealtimeClientMessage): void;
88
+ /**
89
+ * Mute or unmute the session.
90
+ * @param muted - Whether to mute the session.
91
+ */
92
+ mute(muted: boolean): void;
93
+ /**
94
+ * Close the connection to the Realtime API and disconnects the underlying WebRTC connection.
95
+ */
96
+ close(): void;
97
+ /**
98
+ * Interrupt the current response if one is ongoing and clear the audio buffer so that the agent
99
+ * stops talking.
100
+ */
101
+ interrupt(): void;
102
+ }