We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33ee9fb commit 5ea57acCopy full SHA for 5ea57ac
examples/chatCompletions.example.ts
@@ -66,14 +66,14 @@ async function streamingExample() {
66
let fullContent = "";
67
68
for await (const chunk of stream) {
69
- if (chunk.data.choices && chunk.data.choices[0]?.delta?.content) {
70
- const content = chunk.data.choices[0].delta.content;
+ if (chunk.choices && chunk.choices[0]?.delta?.content) {
+ const content = chunk.choices[0].delta.content;
71
process.stdout.write(content);
72
fullContent += content;
73
}
74
75
- if (chunk.data.usage) {
76
- console.log("\n\nStream usage:", chunk.data.usage);
+ if (chunk.usage) {
+ console.log("\n\nStream usage:", chunk.usage);
77
78
79
0 commit comments