Skip to content

Commit 2a9b603

Browse files
committed
fix(audio): correctly handle transcription streaming
1 parent 2d6710a commit 2a9b603

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/resources/audio/transcriptions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ export class Transcriptions extends APIResource {
4040
): Core.APIPromise<TranscriptionCreateResponse | string | Stream<TranscriptionStreamEvent>> {
4141
return this._client.post(
4242
'/audio/transcriptions',
43-
Core.multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }),
43+
Core.multipartFormRequestOptions({
44+
body,
45+
...options,
46+
stream: body.stream ?? false,
47+
__metadata: { model: body.model },
48+
}),
4449
);
4550
}
4651
}

src/streaming.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ export class Stream<Item> implements AsyncIterable<Item> {
4242
continue;
4343
}
4444

45-
if (sse.event === null || sse.event.startsWith('response.')) {
45+
if (
46+
sse.event === null ||
47+
sse.event.startsWith('response.') ||
48+
sse.event.startsWith('transcript.')
49+
) {
4650
let data;
4751

4852
try {

0 commit comments

Comments
 (0)