Skip to content

Commit 03eb57b

Browse files
authoredJun 17, 2024··
Fix missing usageMetadata in streamed aggregated response (#174) (#175)
1 parent 40daf95 commit 03eb57b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

‎.changeset/quick-horses-retire.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@google/generative-ai": patch
3+
---
4+
5+
Fix missing usageMetadata in streamed aggregated response (#174)

‎packages/main/src/requests/stream-reader.ts

+3
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ export function aggregateResponses(
188188
}
189189
}
190190
}
191+
if (response.usageMetadata) {
192+
aggregatedResponse.usageMetadata = response.usageMetadata;
193+
}
191194
}
192195
return aggregatedResponse;
193196
}

0 commit comments

Comments
 (0)
Please sign in to comment.