Skip to content

Missing token usage/cost metrics when using Gemini provider in TruLens #2207

@RockybhaiRakesh

Description

@RockybhaiRakesh

Bug Description
I connected TruLens evaluation with Gemini API and ChromaDB. The dashboard shows runs and evaluation metrics, but the token count and cost are not displayed.

To Reproduce
Install dependencies:

pip install chromadb google-generative-ai trulens-core trulens-providers-google numpy

Set up Gemini API key and ChromaDB client.

Run evaluation with TruLens TruSession and Feedback.

Open the TruLens dashboard

Expected Behavior
The dashboard should display token count and cost for each run, similar to groundedness, answer relevance, and context relevance.

Relevant Logs/Tracebacks
No explicit error in console, but the dashboard UI does not show token usage/cost.

Image

Environment:

OS: Windows 11

Python Version: 3.12.4

TruLens version: 2.3.0

Google Generative AI SDK version: 0.8.5

ChromaDB version: 1.0.20

Additional Context
Tried with both synchronous and async setup, but issue persists. Token usage/cost tracking may not be connected properly for Gemini provider.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions