flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_ai]: thoughtsTokenCount usageMetadata parsed for googleAI SerializationStrategy but not VertexAI

Open davidpryor opened this issue 4 months ago • 0 comments

The newly added ThinkingBudget support added the thoughtsTokenCount parsing only for the GoogleAI Serialization Strategy

GoogleAI: https://github.com/firebase/flutterfire/blob/437e56a4617f96ff96d146008c5e285c51c3ba7d/packages/firebase_ai/firebase_ai/lib/src/developer/api.dart#L247

VertexAI https://github.com/firebase/flutterfire/blob/437e56a4617f96ff96d146008c5e285c51c3ba7d/packages/firebase_ai/firebase_ai/lib/src/api.dart#L1106

The code needs to also be added to VertexSerialization._parseUsageMetadata as it currently will show no thought token usage whether or not they are used or not:

Vertex UsageMetadata in generate content response:

Image

Raw Map in _parseUsageMetadata:

Image

davidpryor avatar Jul 26 '25 03:07 davidpryor