Skip to content

Conversation

cetra3
Copy link

@cetra3 cetra3 commented Oct 1, 2025

Allows the evals page in logfire to present some nice stats in the main comparison table:

image

@cetra3 cetra3 requested review from DouweM and dmontagu October 1, 2025 02:11
Copy link

github-actions bot commented Oct 1, 2025

Docs Preview

commit: 53b4af4
Preview URL: https://dc8262b5-pydantic-ai-previews.pydantic.workers.dev

Copy link
Collaborator

@DouweM DouweM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cetra3 A few comments. More generally, was this added for a specific frontend feature that will look at these attrs and subfields, or more just because it's useful info?

)
if (averages := report.averages()) is not None and averages.assertions is not None:
experiment_metadata = {'n_cases': len(self.cases), 'averages': averages}
eval_span.set_attribute('experiment.metadata', experiment_metadata)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a logfire. prefix here since it's not general OTel but specific to our platform?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue it's specific to pydantic evals, rather than logfire itself?

We use the experiment.metadata field to ingest information about the test run. Are you saying we should change this to logfire.experiment.metadata ? or are you saying underneath experiment.metadata we should have a logfire field.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cetra3 Yeah I was suggesting (based on @alexmojaki suggestion in Slack) to change it to logfire.experiment.metadata. But I see your (implied) point that even though right now only Logfire will use these attributes, they could be useful to users sending pydantic_evals data to different platform as well.

@alexmojaki What do you think about a pydantic_evals prefix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything here is specific to pydantic evals. This is particularly specific not just to logfire but to fusionfire popped attributes. n_cases is being repeated here so that it can be displayed cheaply in the frontend. We may add or remove things here freely depending on what the frontend needs, it's not intended to be queried. I think logfire. makes sense for that.

trace_id=trace_id,
)
if (averages := report.averages()) is not None and averages.assertions is not None:
experiment_metadata = {'n_cases': len(self.cases), 'averages': averages}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the test below, it looks like we already had n_cases in here, do we need to repeat it? Or could we drop it there and have it just under the metadata?

'experiment.metadata': {
'type': 'object',
'properties': {
'averages': {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect n_cases to also be listed here

'logfire.msg': 'evaluate mock_async_task',
'experiment.metadata': {
'n_cases': 2,
'averages': {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to be using this on the frontend, I don't know if it's wise to pass along the entire ReportCaseAggregate object or just the subset we need

Copy link
Collaborator

@DouweM DouweM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cetra3 A few comments. More generally, was this added for a specific frontend feature that will look at these attrs and subfields, or more just because it's useful info?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants