We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3dcaa34 commit 2373885Copy full SHA for 2373885
examples/assistant-stream-raw.ts
@@ -1,3 +1,5 @@
1
+#!/usr/bin/env -S npm run tsn -T
2
+
3
import OpenAI from 'openai';
4
5
const openai = new OpenAI();
@@ -27,7 +29,7 @@ async function main() {
27
29
for await (const event of stream) {
28
30
if (event.event === 'thread.message.delta') {
31
const chunk = event.data.delta.content?.[0];
- if (chunk && 'text' in chunk) {
32
+ if (chunk && 'text' in chunk && chunk.text.value) {
33
process.stdout.write(chunk.text.value);
34
}
35
0 commit comments