@@ -184,22 +184,35 @@ async def test_stream_audio_sends_correct_json():
184
184
185
185
186
186
@pytest .mark .asyncio
187
- async def test_transcription_event_puts_output_in_queue ():
187
+ @pytest .mark .parametrize (
188
+ "created,updated,completed" ,
189
+ [
190
+ (
191
+ {"type" : "transcription_session.created" },
192
+ {"type" : "transcription_session.updated" },
193
+ {"type" : "input_audio_transcription_completed" , "transcript" : "Hello world!" },
194
+ ),
195
+ (
196
+ {"type" : "session.created" },
197
+ {"type" : "session.updated" },
198
+ {
199
+ "type" : "conversation.item.input_audio_transcription.completed" ,
200
+ "transcript" : "Hello world!" ,
201
+ },
202
+ ),
203
+ ],
204
+ )
205
+ async def test_transcription_event_puts_output_in_queue (created , updated , completed ):
188
206
"""
189
- Test that a 'input_audio_transcription_completed' event
207
+ Test that a 'input_audio_transcription_completed' event and
208
+ 'conversation.item.input_audio_transcription.completed'
190
209
yields a transcript from transcribe_turns().
191
210
"""
192
211
mock_ws = create_mock_websocket (
193
212
[
194
- json .dumps ({"type" : "transcription_session.created" }),
195
- json .dumps ({"type" : "transcription_session.updated" }),
196
- # Once configured, we mock a completed transcription event:
197
- json .dumps (
198
- {
199
- "type" : "input_audio_transcription_completed" ,
200
- "transcript" : "Hello world!" ,
201
- }
202
- ),
213
+ json .dumps (created ),
214
+ json .dumps (updated ),
215
+ json .dumps (completed ),
203
216
]
204
217
)
205
218
0 commit comments