getSessionMetrics method
Get session metrics including token usage and performance stats.
FFI (LiteRT-LM): Returns accurate token counts from benchmark info. MediaPipe (Mobile): Returns estimated counts (uses internal metrics if available).
Call this after getResponse or getResponseAsync completes for accurate results.
Implementation
@override
SessionMetrics getSessionMetrics() {
// MediaPipe doesn't expose detailed token metrics via the current platform channel.
// To get metrics on mobile, you would need to:
// 1. Add a new platform method to fetch metrics from native side
// 2. Or track tokens manually using sizeInTokens() before/after generation
//
// For now, return empty metrics. Users can estimate using:
// final inputTokens = await session.sizeInTokens(prompt);
// final outputTokens = await session.sizeInTokens(responseText);
return SessionMetrics();
}