docs(hooks): document all usageMetadata token fields in LLMResponse reference#28057
docs(hooks): document all usageMetadata token fields in LLMResponse reference#28057AriaZhao-coder wants to merge 1 commit into
Conversation
…eference The hooks reference listed usageMetadata with only totalTokenCount, but toHookLLMResponse() and the LLMResponse interface forward all three: promptTokenCount, candidatesTokenCount, and totalTokenCount. Fixes google-gemini#28048
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request corrects the documentation for the LLMResponse interface to ensure it accurately describes the token metadata fields available to hooks. By updating the reference documentation, developers will have a clearer understanding of the data structure, preventing potential confusion regarding available token metrics. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/XS
|
There was a problem hiding this comment.
Code Review
This pull request updates the documentation in docs/hooks/reference.md to expand the usageMetadata schema. Specifically, it adds promptTokenCount and candidatesTokenCount alongside totalTokenCount to provide a more detailed breakdown of token usage. There are no review comments, and I have no additional feedback to provide as the changes are straightforward and correct.
Note: Security Review has been skipped due to the limited scope of the PR.
Summary
The hooks reference (
docs/hooks/reference.md) documentedLLMResponse.usageMetadataas containing a single field:However, the hook actually receives all three token fields. Both the
LLMResponseinterface andtoHookLLMResponse()inpackages/core/src/hooks/hookTranslator.tspopulatepromptTokenCount,candidatesTokenCount, andtotalTokenCount.This PR updates the reference so the documented shape matches what hooks really receive.
Change
Docs-only change; no code behavior is affected.
Fixes #28048