Skip to content

Token count discrepancy Between pydantic-evals and logfire metrics #3529

@manthan-dl

Description

@manthan-dl

Initial Checks

Description

When viewing evaluation results in Logfire, there's a discrepancy between the token counts displayed in the right panel (pydantic-evals metrics) and the aggregated metrics shown in the left panel (logfire metrics).

Screenshot

Image source: https://ai.pydantic.dev/evals/how-to/logfire-integration/#what-gets-sent-to-logfire

Image

Even in the official documentation screenshot, the numbers don't match between the two panels.

Question

Either I am not able to understand the logic behind the difference or there might be some bug here. Can someone please help me understand this?

Example Code

Python, Pydantic AI & LLM client version

python="3.10.0"
pydantic-ai="1.20.0"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions