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 authored and rattrayalex committed Mar 29, 2024
1 parent 2a79781 commit 6e78091
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/MessageStream.ts
Original file line number Diff line number Diff line change
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 6e78091

Please sign in to comment.