Skip to content

Commit

Permalink
Fix missing usageMetadata in streamed aggregated response (#174) (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdoucy authored Jun 17, 2024
1 parent 40daf95 commit 03eb57b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/quick-horses-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@google/generative-ai": patch
---

Fix missing usageMetadata in streamed aggregated response (#174)
3 changes: 3 additions & 0 deletions packages/main/src/requests/stream-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ export function aggregateResponses(
}
}
}
if (response.usageMetadata) {
aggregatedResponse.usageMetadata = response.usageMetadata;
}
}
return aggregatedResponse;
}

0 comments on commit 03eb57b

Please sign in to comment.