fix(ai-gemini): parse usageMetadata in image adapter response#331
fix(ai-gemini): parse usageMetadata in image adapter response#331tecoad wants to merge 1 commit intoTanStack:mainfrom
Conversation
The Gemini image adapter was always returning `usage: undefined` even though the API response includes `usageMetadata` with token counts. Map `usageMetadata` fields to the `ImageGenerationResult.usage` object, consistent with how the OpenAI image adapter already handles usage. Closes TanStack#330 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Gemini image adapter now parses Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
usage: undefinedby mappingusageMetadatafrom the API response to theImageGenerationResult.usagefieldpromptTokenCount→inputTokens,candidatesTokenCount→outputTokens,totalTokenCount→totalTokensCloses #330
Test plan
usageis populated with token countsusageMetadatais absent,usagegracefully falls back toundefinedpnpm test:libandpnpm test:typeson theai-geminipackage🤖 Generated with Claude Code
Summary by CodeRabbit