From a81955175da24e196490a38850bbf6f9b6779ea8 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:38:46 +0000 Subject: [PATCH] fix(example): correcting example (#739) --- examples/assistant-stream-raw.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/assistant-stream-raw.ts b/examples/assistant-stream-raw.ts index a882d219a..399064807 100644 --- a/examples/assistant-stream-raw.ts +++ b/examples/assistant-stream-raw.ts @@ -1,3 +1,5 @@ +#!/usr/bin/env -S npm run tsn -T + import OpenAI from 'openai'; const openai = new OpenAI(); @@ -27,7 +29,7 @@ async function main() { for await (const event of stream) { if (event.event === 'thread.message.delta') { const chunk = event.data.delta.content?.[0]; - if (chunk && 'text' in chunk) { + if (chunk && 'text' in chunk && chunk.text.value) { process.stdout.write(chunk.text.value); } }