Skip to content

Commit

Permalink
fix(streaming): correct accumulation of output tokens (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 29, 2024
1 parent 9456414 commit 76af283
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/MessageStream.ts
Expand Up @@ -450,6 +450,7 @@ export class MessageStream implements AsyncIterable<MessageStreamEvent> {
case 'message_delta':
snapshot.stop_reason = event.delta.stop_reason;
snapshot.stop_sequence = event.delta.stop_sequence;
snapshot.usage.output_tokens = event.usage.output_tokens;
return snapshot;
case 'content_block_start':
snapshot.content.push(event.content_block);
Expand Down

0 comments on commit 76af283

Please sign in to comment.