Skip to content

Commit

Permalink
fix(example): correcting example (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 28, 2024
1 parent 3dcaa34 commit 2373885
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/assistant-stream-raw.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env -S npm run tsn -T

import OpenAI from 'openai';

const openai = new OpenAI();
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 2373885

Please sign in to comment.