flutterfire
flutterfire copied to clipboard
[firebase_ai]: thoughtsTokenCount usageMetadata parsed for googleAI SerializationStrategy but not VertexAI
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:
Raw Map in _parseUsageMetadata: