-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UsageMetadata - add cachedContentTokenCount field #178
Conversation
packages/main/types/responses.ts
Outdated
@@ -98,6 +98,8 @@ export interface UsageMetadata { | |||
candidatesTokenCount: number; | |||
/** Total token count for the generation request (prompt + candidates). */ | |||
totalTokenCount: number; | |||
/** Total token count in the cached part of the prompt, i.e. in the cached content. */ | |||
cachedContentTokenCount: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing just occurred to me, are these in fact always populated? (I'm not even sure about the previously existing fields here.) I know the proto doesn't list any of these as optional but it doesn't seem like these would always be populated in actual practice. If not we should probably make it optional. I did a quick test against autopush not using cached content and I got back the 3 other properties but not this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's not always populated. I figured if this was a problem then the non-cached-content integration tests would have failed.
I can make it optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Add a
cachedContentTokenCount
field to theUsageMetadata
interface returned bygenerateContent
responses.