@@ -6,15 +6,18 @@ import type { MessageEvent as WebSocketMessageEvent } from 'ws';
66// provide better runtime validation when parsing events from the server.
77
88export const realtimeResponse = z . object ( {
9- id : z . string ( ) . optional ( ) ,
10- conversation_id : z . string ( ) . optional ( ) ,
11- max_output_tokens : z . number ( ) . or ( z . literal ( 'inf' ) ) . optional ( ) ,
9+ id : z . string ( ) . optional ( ) . nullable ( ) ,
10+ conversation_id : z . string ( ) . optional ( ) . nullable ( ) ,
11+ max_output_tokens : z . number ( ) . or ( z . literal ( 'inf' ) ) . optional ( ) . nullable ( ) ,
1212 metadata : z . record ( z . string ( ) , z . any ( ) ) . optional ( ) . nullable ( ) ,
13- modalities : z . array ( z . string ( ) ) . optional ( ) ,
14- object : z . literal ( 'realtime.response' ) . optional ( ) ,
15- output : z . array ( z . any ( ) ) . optional ( ) ,
16- output_audio_format : z . string ( ) . optional ( ) ,
17- status : z . enum ( [ 'completed' , 'incomplete' , 'failed' , 'cancelled' ] ) . optional ( ) ,
13+ modalities : z . array ( z . string ( ) ) . optional ( ) . nullable ( ) ,
14+ object : z . literal ( 'realtime.response' ) . optional ( ) . nullable ( ) ,
15+ output : z . array ( z . any ( ) ) . optional ( ) . nullable ( ) ,
16+ output_audio_format : z . string ( ) . optional ( ) . nullable ( ) ,
17+ status : z
18+ . enum ( [ 'completed' , 'incomplete' , 'failed' , 'cancelled' , 'in_progress' ] )
19+ . optional ( )
20+ . nullable ( ) ,
1821 status_details : z . record ( z . string ( ) , z . any ( ) ) . optional ( ) . nullable ( ) ,
1922 usage : z
2023 . object ( {
@@ -26,8 +29,9 @@ export const realtimeResponse = z.object({
2629 . optional ( )
2730 . nullable ( ) ,
2831 } )
29- . optional ( ) ,
30- voice : z . string ( ) . optional ( ) ,
32+ . optional ( )
33+ . nullable ( ) ,
34+ voice : z . string ( ) . optional ( ) . nullable ( ) ,
3135} ) ;
3236
3337// Basic content schema used by ConversationItem.
@@ -315,7 +319,6 @@ export const responseDoneEventSchema = z.object({
315319 type : z . literal ( 'response.done' ) ,
316320 event_id : z . string ( ) ,
317321 response : realtimeResponse ,
318- test : z . boolean ( ) ,
319322} ) ;
320323
321324export const responseFunctionCallArgumentsDeltaEventSchema = z . object ( {
0 commit comments